Article View: gnu.gdb.bug
Article #1255AMD64 backtrace problem on FreeBSD-CURRENT
From: David Xu
Date: Thu, 10 Mar 2005 14:19
Date: Thu, 10 Mar 2005 14:19
80 lines
3688 bytes
3688 bytes
I have a weird stack backtrace problem on FreeBSD amd64,
Here is the demo code:
--------------
#include <ucontext.h>
#include <stdio.h>
void f()
{
printf("hello\n");
exit(0);
}
int main()
{
ucontext_t uc;
char *p;
int len = 1024 * 64;
getcontext(&uc);
p = malloc(len);
uc.uc_stack.ss_sp = p;
uc.uc_stack.ss_size = len;
makecontext(&uc, f, 0);
setcontext(&uc);
return (0);
}
--------------
when debugging, I got weird stack backtrace:
davidxu@sledge:/home/davidxu/ctx> cc -g -o ctx ctx.c
davidxu@sledge:/home/davidxu/ctx> gdb ./ctx
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 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 "amd64-marcel-freebsd"...
(gdb) break main
Breakpoint 1 at 0x40082b: file ctx.c, line 14.
(gdb) break 6
Breakpoint 2 at 0x400804: file ctx.c, line 6.
(gdb) run
Starting program: /dumpster/home/davidxu/ctx/ctx
Breakpoint 1, main () at ctx.c:14
14 int len = 1024 * 64;
(gdb) n
16 getcontext(&uc);
(gdb)
17 p = malloc(len);
(gdb)
18 uc.uc_stack.ss_sp = p;
(gdb)
19 uc.uc_stack.ss_size = len;
(gdb)
20 makecontext(&uc, f, 0);
(gdb)
21 setcontext(&uc);
(gdb)
Breakpoint 2, f () at ctx.c:6
6 printf("hello\n");
(gdb) bt
#0 f () at ctx.c:6
#1 0x000000080066cdf4 in makecontext () from /lib/libc.so.6
#2 0xd0d0d0d0d0d0d0d0 in ?? ()
#3 0x0000000000000000 in ?? ()
#4 0x0000000000000000 in ?? ()
#5 0x0000000000000000 in ?? ()
#6 0x0000000000000000 in ?? ()
#7 0x0000000000000000 in ?? ()
#8 0x0000000000000000 in ?? ()
Error accessing memory address 0x512000: Bad address.
(gdb)
What can cause it to dump non-exist frame ?
David Xu
Technical Details
Message-ID:
<mailman.3291.1110466190.32256.bug-gdb@gnu.org>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mailReferences:
<41c5d73c$0$22313$8fcfb975@news.wanadoo.fr>Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,2004d58c4a1832a3,start X-Google-Attributes: gidf5053,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail From: David Xu <davidxu@freebsd.org> Newsgroups: gnu.gdb.bug Subject: AMD64 backtrace problem on FreeBSD-CURRENT Date: Thu, 10 Mar 2005 22:19:43 +0800 Lines: 84 Approved: bug-gdb@gnu.org Message-ID: <mailman.3291.1110466190.32256.bug-gdb@gnu.org> References: <41c5d73c$0$22313$8fcfb975@news.wanadoo.fr> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.Stanford.EDU 1110465291 6813 199.232.76.165 (10 Mar 2005 14:34:51 GMT) X-Complaints-To: news@news.stanford.edu To: bug-gdb@gnu.org Envelope-to: bug-gdb@gnu.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050306 X-Accept-Language: en-us, en In-Reply-To: <41c5d73c$0$22313$8fcfb975@news.wanadoo.fr> X-BeenThere: bug-gdb@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org> List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>, <mailto:bug-gdb-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/pipermail/bug-gdb> List-Post: <mailto:bug-gdb@gnu.org> List-Help: <mailto:bug-gdb-request@gnu.org?subject=help> List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>, <mailto:bug-gdb-request@gnu.org?subject=subscribe>