From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2080 invoked by alias); 10 Sep 2014 19:11:20 -0000 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 Received: (qmail 2069 invoked by uid 89); 10 Sep 2014 19:11:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.9 required=5.0 tests=AWL,BAYES_50,KAM_STOCKTIP autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Sep 2014 19:11:18 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XRnIP-0001NQ-K8 from Maciej_Rozycki@mentor.com ; Wed, 10 Sep 2014 12:11:14 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 10 Sep 2014 20:11:11 +0100 Date: Wed, 10 Sep 2014 19:11:00 -0000 From: "Maciej W. Rozycki" To: Ulrich Weigand CC: Joel Brobecker , Pedro Alves , GDB Patches Subject: Re: eliminate deprecated_insert_raw_breakpoint. what's left. In-Reply-To: <201409101645.s8AGjLjg024077@d06av02.portsmouth.uk.ibm.com> Message-ID: References: <201409101645.s8AGjLjg024077@d06av02.portsmouth.uk.ibm.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2014-09/txt/msg00341.txt.bz2 On Wed, 10 Sep 2014, Ulrich Weigand wrote: > > I have already identified `mdebugread.h' being the only piece required > > though -- in addition to `mips-mdebug-tdep.h' and `mips-mdebug-tdep.c' > > that were removed from our tree as a result of an unfortunate coincidence > > and have been maintained outside it for years now; they need some > > improvements at the time they are brought back too. Maybe `mdebugread.h' > > can be stripped down a bit and actually folded into `mips-mdebug-tdep.h' > > eventually. > > This confuses me a bit, which is probably because I don't see what's in > mips-mdebug-tdep.c ... For that you'd have to do some archaeology, which is very easy with GIT: $ git log -1 -- gdb/mips-mdebug-tdep.c commit cb2a4ac5dae478fcd9d6e772530c3aba0576fc7a Author: Daniel Jacobowitz Date: Fri Apr 13 14:25:12 2007 +0000 Delete files for last commit. $ git show cb2a4ac5dae478fcd9d6e772530c3aba0576fc7a [...] > Looking at alpha-mdebug-tdep.c, which I had hoped would be mostly equivalent, > this gets the PDR records from the magic MDEBUG_EFI_SYMBOL_NAME symbol, which > is created by mdebugread.c while parsing the .mdebug section in an ELF file > or while parsing an ECOFF file. So if we remove mdebugread.c, nobody will > ever set MDEBUG_EFI_SYMBOL_NAME, which means alpha-mdebug-tdep.c is a no-op. Now that you mention it there is this statement: sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0, NULL); in `mips-mdebug-tdep.c' (in `non_heuristic_proc_desc') indeed, however it's just a fallback in the case where no PDR record has been found. This part can be removed if IRIX support was dropped, we don't expect to have a `.mdebug' section on non-IRIX MIPS ELF targets, so that would become dead code. The structure of PDR itself is documented in [1] and is only a subset of what a `.mdebug' section would include. I can see `alpha-mdebug-tdep.c' doesn't have anything like that, it's quite different overall. > Is this handled differently on mips? [ In general, it would be really > good if mips-mdebug-tdep.c is brought back into the tree if it is actually > being used in practice. Having people maintain stuff out-of-tree long-term > makes it hard to see if common code features are no longer used ... ] That's been long scheduled, but regrettably I have never been able to convince the right people to give it any priority. It's down the n-th patch on the list of oustanding MIPS patches I have. > Also, do you happen to know if on other (non- OSF/1) Alpha platforms the > .mdebug debug format is ever used? On Alpha/Linux you'll get it with `-gstabs', although that'll be along some DWARF information for some reason, at least in the somewhat dated version of Alpha GCC I have, e.g.: $ cat main.c int main (void) { return 0; } $ alpha-linux-gcc -O2 -gstabs -o alpha-linux-main main.c $ alpha-linux-readelf -S alpha-linux-main There are 31 section headers, starting at offset 0x2c750: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .interp PROGBITS 0000000120000200 00000200 0000000000000013 0000000000000000 A 0 0 1 [ 2] .note.ABI-tag NOTE 0000000120000214 00000214 0000000000000020 0000000000000000 A 0 0 4 [ 3] .hash HASH 0000000120000238 00000238 0000000000000040 0000000000000008 A 4 0 8 [ 4] .dynsym DYNSYM 0000000120000278 00000278 0000000000000048 0000000000000018 A 5 1 8 [ 5] .dynstr STRTAB 00000001200002c0 000002c0 0000000000000038 0000000000000000 A 0 0 1 [ 6] .gnu.version VERSYM 00000001200002f8 000002f8 0000000000000006 0000000000000002 A 4 0 2 [ 7] .gnu.version_r VERNEED 0000000120000300 00000300 0000000000000020 0000000000000000 A 5 1 8 [ 8] .rela.plt RELA 0000000120000320 00000320 0000000000000018 0000000000000018 A 4 18 8 [ 9] .init PROGBITS 0000000120000338 00000338 0000000000000068 0000000000000000 AX 0 0 8 [10] .text PROGBITS 00000001200003a0 000003a0 0000000000000250 0000000000000000 AX 0 0 16 [11] .fini PROGBITS 00000001200005f0 000005f0 0000000000000040 0000000000000000 AX 0 0 8 [12] .eh_frame_hdr PROGBITS 0000000120000630 00000630 0000000000000024 0000000000000000 A 0 0 4 [13] .eh_frame PROGBITS 0000000120000658 00000658 000000000000008c 0000000000000000 A 0 0 8 [14] .ctors PROGBITS 00000001200106e8 000006e8 0000000000000010 0000000000000000 WA 0 0 8 [15] .dtors PROGBITS 00000001200106f8 000006f8 0000000000000010 0000000000000000 WA 0 0 8 [16] .jcr PROGBITS 0000000120010708 00000708 0000000000000008 0000000000000000 WA 0 0 8 [17] .dynamic DYNAMIC 0000000120010710 00000710 0000000000000190 0000000000000010 WA 5 0 8 [18] .plt PROGBITS 00000001200108a0 000008a0 000000000000002c 0000000000000000 WAX 0 0 16 [19] .got PROGBITS 00000001200108d0 000008d0 0000000000000020 0000000000000000 WA 0 0 8 [20] .sdata PROGBITS 00000001200108f0 000008f0 0000000000000018 0000000000000000 WAp 0 0 8 [21] .sbss NOBITS 0000000120010908 00000908 0000000000000001 0000000000000000 WAp 0 0 1 [22] .comment PROGBITS 0000000000000000 00000908 000000000000007d 0000000000000000 0 0 1 [23] .debug_aranges PROGBITS 0000000000000000 00000990 0000000000000080 0000000000000000 0 0 16 [24] .debug_info PROGBITS 0000000000000000 00000a10 00000000000000fe 0000000000000000 0 0 1 [25] .debug_abbrev PROGBITS 0000000000000000 00000b0e 0000000000000020 0000000000000000 0 0 1 [26] .debug_line PROGBITS 0000000000000000 00000b2e 0000000000000108 0000000000000000 0 0 1 [27] .mdebug LOPROC+1 0000000000000000 00000c38 000000000002ba08 0000000000000001 0 0 8 [28] .shstrtab STRTAB 0000000000000000 0002c640 000000000000010b 0000000000000000 0 0 1 [29] .symtab SYMTAB 0000000000000000 0002cf10 0000000000000630 0000000000000018 30 49 8 [30] .strtab STRTAB 0000000000000000 0002d540 0000000000000269 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) $ It all gets stripped together though. For MIPS you don't need any debug information to get PDR: $ mips-linux-gcc -O2 -s -o mips-linux-main main.c $ mips-linux-readelf -l mips-linux-main There are 27 section headers, starting at offset 0xa7c: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .interp PROGBITS 00400134 000134 00000d 00 A 0 0 1 [ 2] .note.ABI-tag NOTE 00400144 000144 000020 00 A 0 0 4 [ 3] .reginfo MIPS_REGINFO 00400164 000164 000018 18 A 0 0 4 [ 4] .dynamic DYNAMIC 0040017c 00017c 0000d8 08 A 7 0 4 [ 5] .hash HASH 00400254 000254 000040 04 A 6 0 4 [ 6] .dynsym DYNSYM 00400294 000294 0000b0 10 A 7 1 4 [ 7] .dynstr STRTAB 00400344 000344 000094 00 A 0 0 1 [ 8] .gnu.version VERSYM 004003d8 0003d8 000016 02 A 6 0 2 [ 9] .gnu.version_r VERNEED 004003f0 0003f0 000020 00 A 7 1 4 [10] .init PROGBITS 00400410 000410 0000a4 00 AX 0 0 4 [11] .text PROGBITS 004004c0 0004c0 0002e0 00 AX 0 0 16 [12] .MIPS.stubs PROGBITS 004007a0 0007a0 000020 00 AX 0 0 4 [13] .fini PROGBITS 004007c0 0007c0 000058 00 AX 0 0 4 [14] .rodata PROGBITS 00400818 000818 000004 04 AM 0 0 4 [15] .eh_frame PROGBITS 0040081c 00081c 000004 00 A 0 0 4 [16] .ctors PROGBITS 00410820 000820 000008 00 WA 0 0 4 [17] .dtors PROGBITS 00410828 000828 000008 00 WA 0 0 4 [18] .jcr PROGBITS 00410830 000830 000004 00 WA 0 0 4 [19] .data PROGBITS 00410840 000840 000030 00 WA 0 0 16 [20] .rld_map PROGBITS 00410870 000870 000004 00 WA 0 0 4 [21] .got PROGBITS 00410880 000880 000040 04 WAp 0 0 16 [22] .bss NOBITS 004108c0 0008c0 000010 00 WA 0 0 16 [23] .pdr PROGBITS 00000000 0008c0 000060 00 0 0 4 [24] .comment PROGBITS 00000000 000920 00007d 00 0 0 1 [25] .mdebug.abi32 PROGBITS 0000007d 00099d 000000 00 0 0 1 [26] .shstrtab STRTAB 00000000 00099d 0000dd 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) $ -- see the `.pdr' and `.mdebug.abi32' sections. So its use is quite different to Alpha's `.mdebug' section. I don't know how Alpha performs under GDB in stripped code, I think it just does not at all, just like MIPS without these PDR records (they can be forcefully stripped with `objcopy -R .pdr' or not produced in the first place with GAS's `-mno-pdr' option). References: [1] ftp://ftp.sgi.com/sgi/dev/davea/Mdebug.ps Maciej