[v3,00/14] let gdb reuse gcc's C compiler

Message ID 20141101214552.13230.45564.stgit@host1.jankratochvil.net
State New, archived
Headers

Commit Message

Jan Kratochvil Nov. 1, 2014, 9:45 p.m. UTC
  Hi,

https://github.com/tromey/gdb.git
submit/compile

This is version 3 of the patch to let gdb reuse gcc's C compiler.

Version 2 is here:

    https://sourceware.org/ml/gdb-patches/2014-06/msg00758.html

New in version 3:
 * x86_64 in -m32 mode testsuite run was failing:
     (gdb) compile code -- ;
     Could not find a compiler matching "^i.86-[^-]*-linux(-gnu)?-gcc$"
   Therefore applied the patch included below.
 * Rename dwarf_expr_frame_base_1 -> func_get_frame_base_dwarf_block:
   https://sourceware.org/ml/gdb-patches/2014-10/msg00158.html
 * doc updates:
   https://sourceware.org/ml/gdb-patches/2014-10/msg00164.html

Built and regtested on x86-64, x86_64-m32 and i686 Fedora 21pre in linux-nat
and gdbserver modes.

Going to check it in in a week as v2 has been posted by global maintainer Tom
Tromey and there has already been enough time for its reviews.


Thanks,
Jan
  

Comments

Jan Kratochvil Nov. 1, 2014, 9:52 p.m. UTC | #1
Hi,

I have forgotten the most important:

Current GCC trunk (future 5.0) has now the libcc1.so support checked in by
Phil, therefore this gdb/NEWS addition is now really true:

* GDB now supports the compilation and injection of source code into
  the inferior.  GDB will use GCC 5.0 or higher built with libcc1.so
  to compile the source code to object code, and if successful, inject
  and execute that code within the current context of the inferior.

This makes it relatively easy to test this patchset.


Jan
  
Jan Kratochvil Nov. 1, 2014, 9:56 p.m. UTC | #2
Hi,

FYI there is now also a description of this project at:
	https://sourceware.org/gdb/wiki/GCCCompileAndExecute


Jan
  
Yao Qi Nov. 3, 2014, 12:42 p.m. UTC | #3
Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> This is version 3 of the patch to let gdb reuse gcc's C compiler.

IIRC, this patch series requires related changes in gcc.  Is that part
in gcc now?
  
Jan Kratochvil Nov. 3, 2014, 12:49 p.m. UTC | #4
On Mon, 03 Nov 2014 13:42:55 +0100, Yao Qi wrote:
> IIRC, this patch series requires related changes in gcc.  Is that part
> in gcc now?

Yes, I forgot to update the cover mail but it was immediately replied to it:
	https://sourceware.org/ml/gdb-patches/2014-11/msg00020.html


Jan
  

Patch

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index ca61b1b..ed41f88 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2914,14 +2914,6 @@  static const int amd64_record_regmap[] =
   AMD64_DS_REGNUM, AMD64_ES_REGNUM, AMD64_FS_REGNUM, AMD64_GS_REGNUM
 };
 
-/* gdbarch gnu_triplet_regexp method.  */
-
-static const char *
-amd64_gnu_triplet_regexp (struct gdbarch *gdbarch)
-{
-  return "x86_64";
-}
-
 void
 amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -3071,8 +3063,6 @@  amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_insn_is_call (gdbarch, amd64_insn_is_call);
   set_gdbarch_insn_is_ret (gdbarch, amd64_insn_is_ret);
   set_gdbarch_insn_is_jump (gdbarch, amd64_insn_is_jump);
-
-  set_gdbarch_gnu_triplet_regexp (gdbarch, amd64_gnu_triplet_regexp);
 }
 
 
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 4a59560..56bfd49 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4305,12 +4305,13 @@  i386_stap_parse_special_token (struct gdbarch *gdbarch,
 
 
 
-/* gdbarch gnu_triplet_regexp method.  */
+/* gdbarch gnu_triplet_regexp method.  Both arches are acceptable as GDB always
+   also supplies -m64 or -m32 by gdbarch_gcc_target_options.  */
 
 static const char *
 i386_gnu_triplet_regexp (struct gdbarch *gdbarch)
 {
-  return "i.86";
+  return "(x86_64|i.86)";
 }