This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Add support for .debug_gdb_scripts to mach-o.



On 31 Dec 2011, at 15:12, Iain Sandoe wrote:


There is a testcase for .debug_gdb_scripts in
gdb/testsuite/gdb.python/py-section-script.exp
but I'm not sure it'll work as is on mach-o.

no, it won't - we don't yet support .push/pop section in mach-o gas.

Alas, although that wasn't too hard to implement, we're still some way away from being able to build GCC with GAS, so we still need to work with the native system tools.


(will try to fit in a look at this, at some stage

With http://sourceware.org/ml/gdb-patches/2011-12/msg00890.html applied, the following patch below gives:


Native configuration is i686-apple-darwin9

=== gdb tests ===
...
Running ../../../src-git/gdb/testsuite/gdb.python/py-section- script.exp ...


=== gdb Summary ===

# of expected passes 6

====

NOTES:

1. We cannot put a 'debug' section attribute on the debug_gdb_scripts section, because then dsymutil will automatically strip it from the exe - but (presumably because it's unrecognized) it doesn't put it into the dSYM, even when one specifies 'no_dead_strip'
.. :-( ...


2. The section switch has to be done specifically until we can build with gas.

3. maybe the DEFINE_GDB_SCRIPT macro should be guarded something like...
#if defined (__ELF__)
...
#elif defined (__MACH__)
...
(but I'm not sure how many targets can use it as stands...)

cheers
Iain

====


diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index cc68d89..1404bb9 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -195,6 +195,9 @@ static const mach_o_section_name_xlat dwarf_section_names_xlat[] =
{ ".debug_macro", "__debug_macro",
SEC_DEBUGGING, BFD_MACH_O_S_REGULAR,
BFD_MACH_O_S_ATTR_DEBUG, 0},
+ { ".debug_gdb_scripts", "__debug_gdb_scr",
+ SEC_DEBUGGING, BFD_MACH_O_S_REGULAR,
+ BFD_MACH_O_S_ATTR_NO_DEAD_STRIP, 0},
{ NULL, NULL, 0, 0, 0, 0}
};



diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 804d42b..4953a91 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -559,7 +561,8 @@ static const char * const debug_sections[] = /* 9 */ ".debug_pubtypes", /* 10 */ ".debug_str", /* 11 */ ".debug_ranges", - /* 12 */ ".debug_macro" + /* 12 */ ".debug_macro", + /* 13 */ ".debug_gdb_scripts", };

/* ??? Maybe these should be conditional on gdwarf-*.
@@ -1064,6 +1067,7 @@ const pseudo_typeS mach_o_pseudo_table[] =
{ "debug_str", obj_mach_o_debug_section, 10}, /* extension. */
{ "debug_ranges", obj_mach_o_debug_section, 11}, /* extension. */
{ "debug_macro", obj_mach_o_debug_section, 12}, /* extension. */
+ { "debug_gdb_scripts", obj_mach_o_debug_section, 13}, /* extension. */


{ "lazy_symbol_pointer", obj_mach_o_opt_tgt_section, 1},
{ "lazy_symbol_pointer2", obj_mach_o_opt_tgt_section, 2}, /* extension. */


diff --git a/gdb/testsuite/gdb.python/py-section-script.c b/gdb/ testsuite/gdb.python/py-section-script.c
index 1ead7dd..6d48071 100644
--- a/gdb/testsuite/gdb.python/py-section-script.c
+++ b/gdb/testsuite/gdb.python/py-section-script.c
@@ -18,6 +18,7 @@
/* Put the path to the pretty-printer script in .debug_gdb_scripts so
gdb will automagically loaded it. */


+#ifndef __MACH__
 #define DEFINE_GDB_SCRIPT(script_name) \
   asm("\
 .pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n\
@@ -25,6 +26,14 @@
 .asciz \"" script_name "\"\n\
 .popsection \n\
 ");
+#else
+#define DEFINE_GDB_SCRIPT(script_name) \
+  asm(".section __DWARF,__debug_gdb_scr,regular,no_dead_strip\n\
+	.byte 1\n\
+	.asciz \"" script_name "\"\n\
+	.text\n\
+      ");
+#endif

DEFINE_GDB_SCRIPT ("py-section-script.py")


diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/ testsuite/gdb.python/py-section-script.exp
index 31fdcf8..1cde576 100644
--- a/gdb/testsuite/gdb.python/py-section-script.exp
+++ b/gdb/testsuite/gdb.python/py-section-script.exp
@@ -24,7 +24,8 @@ if {![istarget *-*-linux*]
&& ![istarget *-*-openbsd*]
&& ![istarget arm*-*-eabi*]
&& ![istarget arm*-*-symbianelf*]
- && ![istarget powerpc-*-eabi*]} {
+ && ![istarget powerpc-*-eabi*]
+ && ![istarget i?86-*-darwin*]} {
verbose "Skipping py-section-script.exp because of lack of support."
return
}




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]