From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1527 invoked by alias); 1 Jan 2012 19:07:59 -0000 Received: (qmail 1510 invoked by uid 22791); 1 Jan 2012 19:07:58 -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 c2beaomr07.btconnect.com (HELO mail.btconnect.com) (213.123.26.185) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 01 Jan 2012 19:07:41 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2beaomr07.btconnect.com with ESMTP id FSC52989; Sun, 01 Jan 2012 19:07:39 +0000 (GMT) Cc: gdb-patches@sourceware.org, binutils Development Message-Id: <9DF778D7-0B95-45CF-BA18-5890788BFE3C@sandoe-acoustics.co.uk> From: Iain Sandoe To: Doug Evans , Tristan Gingold In-Reply-To: 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: Sun, 01 Jan 2012 19:07:00 -0000 References: <20111228002342.D4E232461C9@ruffy.mtv.corp.google.com> X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4F00AEFA.0053, actions=tag X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2012.1.1.183916: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, __CP_URI_IN_BODY, __LINES_OF_YELLING, BODY_SIZE_4000_4999, __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.0A0B020D.4F00AEFB.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: 2012-01/txt/msg00001.txt.bz2 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 }