From: Andreas Johansson <ajo@wopr.campus.luth.se>
Subject: Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
Date: Tue, 22 Oct 1996 14:55:52 +0200 (MET DST) [thread overview]
Message-ID: <199610221255.OAA12090@wopr.campus.luth.se> (raw)
In-Reply-To: <199610212347.QAA16251@web.azstarnet.com>
> > Well, I have found that single-stepping on malloc coredumps gdb every
> > time and with every program (and both c and c++). So this is probably
> > not your problem. If you set a breakpoint further away it works.
>
> Most likely this is due to insufficient debug info in libc.
> Unfortunately, gdb on Alpha does not handle this situation well (and,
> even in the best case, there is only so much gdb can do without
> debugging info---the DEC Unix calling convention is highly optimized
> and just looking at the code etc will not give you all the information
> to, say, backtrack in the stack).
Ok, by single-stepping on malloc I didn't mean that I wanted to single-
step into the function, but simply over it (not "step" but "next" in gdb).
Watch this:
--------------------------------- malloc_gdb.c -------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{
int num;
char *str;
if (argc < 2)
return (0);
if (!strcmp ("asdf", argv[1]))
printf ("asdf\n");
num = strlen (argv[1]);
str = (char *) malloc (num);
strcpy (str, argv[1]);
printf ("String: %s\n", str);
free (str);
return (0);
}
------------------------------ At the shellprompt ----------------------------
ajo@wopr ~/src/test >gcc -static -g -o malloc_gdb malloc_gdb.c
ajo@wopr ~/src/test >gdb malloc_gdb
GDB is free software and you are welcome to 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.
GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
(gdb) break main
Breakpoint 1 at 0x1200005e8: file malloc_gdb.c, line 10.
(gdb) run asdfkasld
Starting program: /home/ajo/src/test/malloc_gdb asdfkasld
Breakpoint 1, main () at malloc_gdb.c:10
10 if (argc < 2)
(gdb) next
13 if (!strcmp ("asdf", argv[1]))
(gdb)
16 num = strlen (argv[1]);
(gdb)
18 str = (char *) malloc (num);
(gdb)
Segmentation fault (core dumped)
Exit 139
ajo@wopr ~/src/test >gdb /usr/bin/gdb core
GDB is free software and you are welcome to 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.
GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
(no debugging symbols found)...
Core was generated by gdb malloc_gdb'.
Program terminated with signal 11, Segmentation fault.
#0 0x12005e8ec in make_function_type ()
(gdb) bt
#0 0x12005e8ec in make_function_type ()
#1 0x12005e988 in lookup_function_type ()
#2 0x1200ac7c8 in mdebug_build_psymtabs ()
#3 0x1200b1c70 in ecoff_relocate_efi ()
#4 0x1200bca28 in xmmalloc ()
#5 0x1200d0450 in bfd_find_target ()
warning: Hit beginning of text section without finding
warning: enclosing function for address 0x11ffff520
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable). In that case, you may wish to
increase the size of the search with the set heuristic-fence-post' command.
Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
(gdb)
------------------------------------------------------------------------------
As you can see strcmp and strlen works quite ok, but malloc makes gdb
coredump. Curiously enough this only happends on statically linked elf-
binaries, but on the other hand, those are often much more practical to
debug.
--
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
: E-mail: ajo@wopr.campus.luth.se :
: S-mail: Andreas Johansson, Karhusvagen 5 6:618, 977 54 Lulea, SWEDEN :
: Have you had your dose of 261.62 BogoMIPS today? - Run Alpha! :
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
next prev parent reply other threads:[~1996-10-22 12:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-10-21 23:47 (re)compiling gcc-2.7.2.1 under linux alpha: note && question David Mosberger
1996-10-22 12:55 ` Andreas Johansson [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-10-27 1:15 Matthew Jacob
1996-10-27 0:22 Matthew Jacob
1996-10-26 21:27 Craig Burley
1996-10-26 18:21 Matthew Jacob
1996-10-26 9:53 Craig Burley
1996-10-26 12:50 ` Richard Henderson
1996-10-22 2:21 Matthew Jacob
1996-10-21 18:09 Craig Burley
1996-10-21 22:23 ` Andreas Johansson
1996-10-21 16:02 Matthew Jacob
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox