This is the mail archive of the gdb@sourceware.org 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]

syscall backtraces on arn-linux-gnu


Hello,

I can't get gdb 6.8.50.20090804 to print complete backtraces on
arm-linux-gnu. Consider the following example:

#include <stdio.h>
#include <unistd.h>
#include <sys/select.h>

int
main(void)
{       
        fd_set rfds;
        FD_ZERO(&rfds);
        FD_SET(STDIN_FILENO, &rfds);
        if (select(STDIN_FILENO + 1, &rfds, NULL, NULL, NULL) == -1) {
                perror("select");
                return 2;
        }
        return 0;
}

Proceeding as follows results in the output below:

host$ arm-linux-gnu-gcc -g a.c
target$ gdb a.out
(gdb) r
...
Ctrl-C
...
(gdb) bt
#0  0x400e16c8 in select () from /lib/libc.so.6
#1  0x00000000 in ?? ()

I stopped on select and stepped through the instructions. The function
starts like this:

        push    {lr}
        ...
        push    {r4}
        ...
        svc     0x0090008e
        pop     {r4}       
        ...

I've seen that bt starts showing incorrect results after the second
push; after the pop, bt becomes good again. This is unfortunate, since
signals are often delivered upon the syscall exit, and analyzing such
core files is harder.

FWIW, this behavior is the same with and without glibc symbols (loaded
via setting solib-absolute-prefix). Also, glibc's backtrace() does print
something (it can't resolve all names correctly, and I haven't checked
whether the library address in that backtrace is correct and the same
when the binary is loaded under gdb -- at least info symbol said "No
function contains specified address.").

I'd like to be able to get complete backtraces with gdb; so, my
questions are:

1. How can I fix the problem?

2. If there is no quick fix, is it possible to help gdb print the
   correct bt?

Thanks in advance,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/


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