Bug 108682 - Gdb segfaults after using command script associated with breakpoint
Gdb segfaults after using command script associated with breakpoint
Status: CLOSED CANTFIX
Product: Red Hat Linux
Classification: Retired
Component: gdb (Show other bugs)
9
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jan Kratochvil
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-10-30 23:05 EST by Enrique Perez-Terron
Modified: 2007-04-18 12:59 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-01-02 14:00:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Enrique Perez-Terron 2003-10-30 23:05:25 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.5) Gecko/20031016

Description of problem:
Using the gdb command "commands" to associate a script of gdb commands with a
breakpoint, gdb segfaults. The problem seems to be related to the use of a
"continue" command in the body of an "if" command.

Although this message does not appear in the first example below, in some cases
I get a warning message from gdb saying

   warning: invalid control type in command structure

The first example below was created with the current gdb,
gdb-5.3post-0.20021129.18. 

I repeated the exactly same experiment  with gdb-6.0 compiled with "./configure
--prefix=/usr; make; make install", and this time the warning message did show up.

How reproducible:
Always

Steps to Reproduce:
1. Type the following test program and save it as /tmp/gdb-test.c:

static void stopme()
{
}

int main(int argc, char *argv[])
{
   int i;
   for (i=0; i < 3; ++i)
      stopme();
}

2. compile it with gcc -g -o gdb-test gdb-test.c
3. Prepare a script of gdb commands in a file /tmp/gdb-script:

    set $a = 0
    b stopme
    command
    set $a = $a + 1
    if $a < 3
    cont
    end
    end
    run

Start gdb and issue the single command "source /tmp/gdb-script"

Actual Results:  Debugger segmentation fault

Expected Results:  Gdb should stop after reaching the breakpoint 
the third time, and issue a new promt.


Additional info:

Here is the complete contents of the emacs debugger buffer:

Current directory is /tmp/
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) source gdb-script
Breakpoint 1 at 0x80482f7: file gdb-test.c, line 3.

Breakpoint 1, stopme () at gdb-test.c:3

Breakpoint 1, stopme () at gdb-test.c:3

Debugger segmentation fault

------

After removing the gdb rpm and installing gdb-6.0 from source tarball, I
repeated the experiment with the following results:

Current directory is /tmp/
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-linux-gnu"...
(gdb) source /tmp/gdb-script
Breakpoint 1 at 0x80482f7: file gdb-test.c, line 3.

Breakpoint 1, stopme () at gdb-test.c:3

Breakpoint 1, stopme () at gdb-test.c:3

Breakpoint 1, stopme () at gdb-test.c:3
warning: Invalid control type in command structure.

Program exited with code 0204.

Debugger segmentation fault


In case I have used wrong syntax or similar, consider improving the
docuemtation. I have used the gdb command "help if".
Comment 1 Jan Kratochvil 2006-07-25 08:09:39 EDT
Not reproducible on FC5 (gdb-6.3.0.0-1.122), to be closed as CLOSED-CURRENTRELEASE.

(gdb) source /tmp/gdb-script
Breakpoint 1 at 0x8048357: file gdb-test.c, line 3.

Breakpoint 1, stopme () at gdb-test.c:3
3       }

Breakpoint 1, stopme () at gdb-test.c:3
3       }

Breakpoint 1, stopme () at gdb-test.c:3
3       }
(gdb) 
Comment 2 Bill Nottingham 2006-08-05 00:30:33 EDT
Red Hat apologizes that these issues have not been resolved yet. We do want to
make sure that no important bugs slip through the cracks.

Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc.
They are maintained by the Fedora Legacy project (http://www.fedoralegacy.org/)
for security updates only. If this is a security issue, please reassign to the
'Fedora Legacy' product in bugzilla. Please note that Legacy security update
support for these products will stop on December 31st, 2006.

If this is not a security issue, please check if this issue is still present
in a current Fedora Core release. If so, please change the product and version
to match, and check the box indicating that the requested information has been
provided.

If you are currently still running Red Hat Linux 7.3 or 9, please note that
Fedora Legacy security update support for these products will stop on December
31st, 2006. You are strongly advised to upgrade to a current Fedora Core release
or Red Hat Enterprise Linux or comparable. Some information on which option may
be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/.

Any bug still open against Red Hat Linux 7.3 or 9 at the end of 2006 will be
closed 'CANTFIX'. Again, if this bug still exists in a current release, or is a
security issue, please change the product as necessary. We thank you for your
help, and apologize again that we haven't handled these issues to this point.
Comment 4 Bill Nottingham 2007-01-02 14:00:04 EST
Red Hat Linux 7.3 and Red Hat Linux 9 are no longer supported by Red Hat, Inc.
f you are currently still running Red Hat Linux 7.3 or 9, you are strongly
advised to upgrade to a current Fedora Core release or Red Hat Enterprise Linux
or comparable. Some information on which option may be right for you is
available at http://www.redhat.com/rhel/migrate/redhatlinux/.

Closing as CANTFIX.

Note You need to log in before you can comment on or make changes to this bug.