This is the mail archive of the gdb-prs@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]
Other format: [Raw text]

gdb/581: single-step causes SIGSEGV


>Number:         581
>Category:       gdb
>Synopsis:       single-step causes SIGSEGV
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 20 15:18:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     paul@parasoft.com
>Release:        gdb-5.2
>Organization:
>Environment:
Linux RedHat-6.2, gdb 5.0 through 5.2, g++-2.95.3 and
g++-3.0
>Description:
Compiling test case with g++-2.95.3 or 3.0, then
single-stepping (but not single-instruction stepping)
throgh call to func() causes SIGSEGV ...

The problem reproduces with g++-2.95.3-compiled and
g++-3.0 code on gdb 5.0, 5.1 and 5.2 ...
With g++-3.1 gdb-5.2 works, although still issues a warning

It appears that when "step"ping the temporary breakpoint is inserted into the middle of the instruction, not the beginning of it.

This also appears to be the same problem as PR 299, but we have a test case, and they don't ;-)

--- cut here --- junk.cc ---
#include <string>

void func(const char *s, const char *q)
{
}

using namespace std;
main()
{
    string a("hello"), b("world");
    func(a.c_str(), b.c_str());
    return 0;
}
--- cut here --- junk.cc ---

>How-To-Repeat:
$ /usr/local/gcc-2.95.3/bin/g++ -g junk.cc
$ /home/linux2/paul/gdb-5.2/gdb/gdb ./a.out
GNU gdb 5.2
Copyright 2002 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 "i686-pc-linux-gnu"...
(gdb) b main
Breakpoint 1 at 0x804a66e: file junk.cc, line 10.
(gdb) r
Starting program: /home/camel2/dstover/bug14518/a.out 

Breakpoint 1, main () at junk.cc:10
10          string a("hello"), b("world");
(gdb) n
11          func(a.c_str(), b.c_str());
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x08052369 in basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::c_str (this=0xbffff5a0) at std/bastring.h:154
154     std/bastring.h: No such file or directory.
        in std/bastring.h
 disas
Dump of assembler code for function c_str__Ct12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b1i0:
0x8052360 : push   %ebp
0x8052361 : mov    %esp,%ebp
0x8052363 : sub    $0x14,%esp
0x8052366 : push   %ebx
0x8052367 : mov    0x8(%ebp),%ebx
0x805236a : add    $0xfffffff4,%esp

Note that crash-address 0x08052369 in in the middle of fourths instruction.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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