From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19398 invoked by alias); 31 Dec 2011 15:12:33 -0000 Received: (qmail 19379 invoked by uid 22791); 31 Dec 2011 15:12:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_GD X-Spam-Check-By: sourceware.org Received: from c2bthomr14.btconnect.com (HELO mail.btconnect.com) (213.123.20.132) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 31 Dec 2011 15:12:15 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2bthomr14.btconnect.com with ESMTP id FRR17812; Sat, 31 Dec 2011 15:12:13 +0000 (GMT) Cc: gdb-patches@sourceware.org, binutils@sourceware.org Message-Id: From: Iain Sandoe To: Doug Evans In-Reply-To: <20111228002342.D4E232461C9@ruffy.mtv.corp.google.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: [RFC] Add support for .debug_gdb_scripts to mach-o. Date: Sat, 31 Dec 2011 20:11:00 -0000 References: <20111228002342.D4E232461C9@ruffy.mtv.corp.google.com> X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4EFF264B.00DE, actions=tag X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2011.12.31.141515:17:7.944, ip=81.138.1.83, rules=__MULTIPLE_RCPTS_CC_X2, __HAS_MSGID, __SANE_MSGID, __MSGID_APPLEMAIL, __TO_MALFORMED_2, __CT, __CT_TEXT_PLAIN, __CTE, __MIME_VERSION, __MIME_VERSION_APPLEMAIL, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __HAS_X_MAILER, __X_MAILER_APPLEMAIL, __ANY_URI, __URI_NO_MAILTO, __URI_NO_WWW, __C230066_P3_4, __CP_URI_IN_BODY, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_2000_2999, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, __USER_AGENT_APPLEMAIL, MULTIPLE_RCPTS, RDNS_SUSP, BODY_SIZE_7000_LESS X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0201.4EFF264D.00A2,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2011-07-25 19:15:43, dmn=2011-05-27 18:58:46, mode=multiengine X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00919.txt.bz2 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