This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: eliminate deprecated_insert_raw_breakpoint. what's left.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]