This is the mail archive of the gdb-patches@sources.redhat.com 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]

Simple but crucial bug fix to gdb


Dear gdb maintainer,

I would like to submit a very simple patch to gdb.
I would like if possible to avoid legal issues (avoid having to
submit a form to our legal department) by simply describing the fix,
which is a diff of only a few characters, rather than sending you a
source file.

Bug description:  gdb 4.xx and 5.0 crashes while reading our executable.
Our executable is the result of linking objects compiled by gcc with
other objects compiled using SPARCworks CC.  The stack trace is
appended at the end of this message.

Unfortunately the executable is large and proprietary.
Although I can't submit a test case, it is very easy to confirm by
inspecting the code that the patch is correct and the original code
is incorrect.  The patch is as follows:

File: gdb-5.0/gdb/partial-stab.h

OLD, lines 602-605:

        if (textlow_not_set
            || (CUR_SYMBOL_VALUE < pst->textlow
                && CUR_SYMBOL_VALUE
                != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT)))
          {
            pst->textlow = CUR_SYMBOL_VALUE;

NEW, lines 602-605:

        if (pst && (textlow_not_set
            || (CUR_SYMBOL_VALUE < pst->textlow
                && CUR_SYMBOL_VALUE
                != ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT))))
          {
            pst->textlow = CUR_SYMBOL_VALUE;

OLD crashes because pst is 0 (and is intended to be 0 I think).

I hope this is enough for you to get this included in the next release.
I hate maintaining patches.  Please let me know if there is anything
else I can do for you about this.  Thank you!

-- Charlie Mills
   cmills@synopsys.com  (work)
   mills@q7.com         (personal)
   (503) 748-2665       (work)


#0  0xc4810 in read_dbx_symtab (objfile=0x1f7120) at partial-stab.h:602
#1  0xc2a94 in dbx_symfile_read (objfile=0x1f7120, mainline=0) at
dbxread.c:631
#2  0xc6974 in elfstab_build_psymtabs (objfile=0x1f7120, mainline=0, 
    staboffset=59705972, stabsize=2080088, stabstroffset=72560872, 
    stabstrsize=59705971) at dbxread.c:2652
#3  0xca24c in elf_symfile_read (objfile=0x1f7120, mainline=0) at
elfread.c:663
#4  0x5384c in syms_from_objfile (objfile=0x1f7120, addrs=0xffbedde8, 
    mainline=1, verbo=0) at symfile.c:807
#5  0x53a74 in symbol_file_add (
    name=0x1edee0 "/u/formal/nightly/synopsys/sparcOS5/fm/bin/fm_gui-g", 
    from_tty=0, addrs=0x0, mainline=1, flags=32) at symfile.c:943
#6  0x53d70 in symbol_file_command (args=0x1d7140 "", from_tty=0)
    at symfile.c:1087
#7  0x91a58 in do_captured_command (data=0xffbee468) at top.c:679
#8  0x919c8 in catch_errors (func=0x91a44 <do_captured_command>, 
    args=0xffbee468, errstring=0x16d438 "", mask=6) at top.c:615
#9  0x91a90 in catch_command_errors (command=0x53b84 <symbol_file_command>, 
    arg=0xffbeeaa7 "/u/formal/nightly/synopsys/sparcOS5/fm/bin/fm_gui-g", 
    from_tty=0, mask=6) at top.c:699
#10 0x34634 in captured_main (data=0xffbee864) at main.c:603
#11 0x919c8 in catch_errors (func=0x33d4c <captured_main>, args=0xffbee7e8, 
    errstring=0x14e880 "", mask=6) at top.c:615
#12 0x348e8 in main (argc=2, argv=0xffbee864) at main.c:761


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