Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Iain Sandoe <developer@sandoe-acoustics.co.uk>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org, binutils@sourceware.org
Subject: Re: [RFC] Add support for .debug_gdb_scripts to mach-o.
Date: Sat, 31 Dec 2011 20:11:00 -0000	[thread overview]
Message-ID: <F3A1D139-2450-423C-B4AE-480BBD92E154@sandoe-acoustics.co.uk> (raw)
In-Reply-To: <20111228002342.D4E232461C9@ruffy.mtv.corp.google.com>

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


  reply	other threads:[~2011-12-31 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28  0:35 Doug Evans
2011-12-31 20:11 ` Iain Sandoe [this message]
2012-01-01 19:07   ` Iain Sandoe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F3A1D139-2450-423C-B4AE-480BBD92E154@sandoe-acoustics.co.uk \
    --to=developer@sandoe-acoustics.co.uk \
    --cc=binutils@sourceware.org \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox