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.


Hi Doug,

On 28 Dec 2011, at 00:23, Doug Evans wrote:
I have no means of testing this.

bfd/binutils is pretty good with i686-apple-darwin9 as a target (and gas is gradually getting there);
.. gdb also builds for that target with the mods noted below.


And it's not clear that adding .debug_gdb_scripts to dwarf_section_names_xlat
is reasonable.

It seems the right place to me...


Can anyone using mach-o test this,

.. in its own right, it builds, but needs the following to add it to GAS:


diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 74fb0c9..97762f8 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -526,7 +526,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-*.
@@ -823,6 +824,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. */



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.


I suppose we should .. but not sure when it will hit the top of the TODO ;)

===

However, in the interim, Darwin's [native] ld supports creating a section from a file.
(so there's a non-assembler way of doing this too).


from darwin's man ld:

Options that control additional content
-sectcreate segname sectname file
The section sectname in the segment segname is created from the contents of
file file. The combination of segname and sectname must be unique D there
cannot already be a section (segname,sectname) from any other input.


... so the following ought to work ...

ld -sectcreate __DWARF __debug_gdb_scr python-script-file.py

(will try to fit in a look at this, at some stage - one would need http://sourceware.org/ml/gdb-patches/2011-12/msg00890.html as well, to make it build).

cheers
Iain


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