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]

breakpoints/1407: Gdb with gcc on Solaris crashes with segmentation fault when using "call"


>Number:         1407
>Category:       breakpoints
>Synopsis:       Gdb with gcc on Solaris crashes with segmentation fault when using "call"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 06 07:18:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     jakobn@kth.se
>Release:        GNU gdb 5.3
>Organization:
>Environment:
uname-a : SunOS rungner.nada.kth.se 5.8 Generic_108528-18 sun4u sparc SUNW,Sun-Fire-280R
gcc-v : gcc version 3.3
This GDB was configured as "sparc-sun-solaris2.8"...
>Description:
GDB crashes with segmentation fault when using "call" to call a function in the program from a breakpoint. Like this (files are attached to this report and follow at the end of the screen dump):

computer>gcc -v 
Reading specs from /pkg/gcc/3.3/os/lib/gcc-lib/sparc-sun-solaris2.9/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/pkg/gcc/3.3/os
Thread model: posix
gcc version 3.3
computer>gcc -g dumbprogram.c 
computer>gdb a.out 
GNU gdb 5.3
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 "sparc-sun-solaris2.8"...
(gdb) source dumb.gdb 
Breakpoint 1 at 0x10780: file dumbprogram.c, line 25.
(gdb) run
Starting program: /afs/nada.kth.se/home/theory/jakobn/doktorandstudier/proofsearch/newAndOldStuff/a.out 
The value is 5.
A message to stderr.

Program received signal SIGSEGV, Segmentation fault.
<function called from gdb>
Segmentation Fault
[and GDB crashes so badly that we get back to the shell prompt!]
computer>more dumb.gdb 

break dumbprogram.c:25
commands
        silent
        call dummyfunc (j)
        continue
end
computer>more dumbprogram.c 

#include <stdio.h>
#include <stdlib.h>

void
dummyfunc (
    int    i)
{
    fprintf (stderr, "The value is %d.\n", i);
}


int
main (
    int      argc,
    char   **argv)
{
    int      j;

    j = 5;

    dummyfunc (j);

    fprintf (stderr, "A message to stderr.\n");

    j = 6;
    
    return 0;
}

>How-To-Repeat:
Use the attached files and do:
gcc -g dumbprogram.c
gdb a.out
(gdb) source dumb.gdb
(gdb) run
>Fix:
Yes please! ;-)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="alldumbfiles.txt"
Content-Disposition: inline; filename="alldumbfiles.txt"

::::::::::::::
dumbprogram.c
::::::::::::::

#include <stdio.h>
#include <stdlib.h>

void
dummyfunc (
    int    i)
{
    fprintf (stderr, "The value is %d.\n", i);
}


int
main (
    int      argc,
    char   **argv)
{
    int      j;

    j = 5;

    dummyfunc (j);

    fprintf (stderr, "A message to stderr.\n");

    j = 6;
    
    return 0;
}

::::::::::::::
dumb.gdb
::::::::::::::

break dumbprogram.c:25
commands
	silent
	call dummyfunc (j)
	continue
end


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