Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@codesourcery.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	Pedro Alves <palves@redhat.com>,
	GDB Patches <gdb-patches@sourceware.org>
Subject: Re: eliminate deprecated_insert_raw_breakpoint.  what's left.
Date: Wed, 10 Sep 2014 19:11:00 -0000	[thread overview]
Message-ID: <alpine.DEB.1.10.1409101840160.27075@tp.orcam.me.uk> (raw)
In-Reply-To: <201409101645.s8AGjLjg024077@d06av02.portsmouth.uk.ibm.com>

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 <drow@false.org>
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


  reply	other threads:[~2014-09-10 19:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.DEB.1.10.1409101553070.27075@tp.orcam.me.uk>
2014-09-10 16:45 ` Ulrich Weigand
2014-09-10 19:11   ` Maciej W. Rozycki [this message]
2014-09-11 11:50     ` Ulrich Weigand
2014-09-08 17:46 Pedro Alves
2014-09-08 19:24 ` Joel Brobecker
2014-09-08 21:34   ` Joel Brobecker
2014-09-08 22:50     ` Pedro Alves
2014-09-09  0:25       ` Peter Schauer
2014-09-09  0:16     ` Peter Schauer
2014-09-09 11:39       ` Ulrich Weigand
2014-09-09 12:38         ` Peter Schauer
2014-09-09 21:25           ` Ulrich Weigand
2014-09-10 12:21             ` Joel Brobecker
2014-09-10 13:15               ` Ulrich Weigand
2014-09-10 15:22                 ` Pedro Alves
2014-09-09 21:48   ` Ulrich Weigand
2014-09-10 12:29     ` Joel Brobecker
2014-09-10 14:45       ` Ulrich Weigand
2014-09-10 15:21         ` Pedro Alves
2014-09-10 15:50           ` Joel Brobecker
2014-09-10 16:00             ` Sergio Durigan Junior
2014-09-10 16:36             ` Ulrich Weigand
2014-09-10 15:50           ` Maciej W. Rozycki
2014-10-07  0:25         ` Stan Shebs
2014-09-09 17:33 ` Pedro Alves

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=alpine.DEB.1.10.1409101840160.27075@tp.orcam.me.uk \
    --to=macro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=uweigand@de.ibm.com \
    /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