gdb/2093: gdb gets a segmentation violation when looking up functions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gdb/2093: gdb gets a segmentation violation when looking up functions

John Klingler

>Number:         2093
>Category:       gdb
>Synopsis:       gdb gets a segmentation violation when looking up functions
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 02 19:58:03 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     John Klingler
>Release:        6.3
>Organization:
>Environment:
Dual Xeon, Red Hat Linux 2.6.11-1.1369_FC4 SMP
>Description:
Running gdb 6.3 under ddd 3.3.10, Using Lookup to find a function causes gdb to get a segmentation violation.

The code being debugged was a driver module written in C, compiled with gcc 4.0.0.

I traced the problem to find_line_pc_range in symtab.c. It was trying to xfree an uninitialized pointer with a value of 0x01.
>How-To-Repeat:
It always happens in some programs but not in others, sorry.
>Fix:
In symtab.c:
change line 2418 from
  CORE_ADDR *pc_list;
to
  CORE_ADDR *pc_list = (CORE_ADDR*)0;

Change lines 2429 to 2432 from
  if (startaddr == 0)
    startaddr = pc_list[0];

  xfree (pc_list);
to
  if(pc_list)
  {
    if (startaddr == 0)
      startaddr = pc_list[0];

    xfree (pc_list);
  }

NOTE: xfree might be all right if pc_list == 0, I didn't try that. It definitely is not all right if pc_list == 1.
>Release-Note:
>Audit-Trail:
>Unformatted:
Reply | Threaded
Open this post in threaded view
|

Re: gdb/2093: gdb gets a segmentation violation when looking up functions

JimB-3
Synopsis: gdb gets a segmentation violation when looking up functions

Responsible-Changed-From-To: unassigned->jimb
Responsible-Changed-By: jimb
Responsible-Changed-When: Thu Mar  2 22:58:38 2006
Responsible-Changed-Why:
    I'll take it.
State-Changed-From-To: open->feedback
State-Changed-By: jimb
State-Changed-When: Thu Mar  2 22:58:38 2006
State-Changed-Why:
    Have you tried reproducing this with GDB 6.4?  It seems to be fixed there.
   
    (By the way, it's much easier for people to work with if you publish changes as patches created by the 'diff' program, rather than describing the changes to be made in English.  We generally use 'diff -u' or 'diff -c'.)

http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2093