This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EVM 板卡使用 GDB ,无法调试



如题,这里是所有信息:

使用 GDB版本:GNU gdb (Linaro GDB) 7.6-2013.05  从官网下载之后编译。

SDK : SDK 8.0

rootfs : ti-sdk-am335x-evm-08.00.00.00/filesytem/tisdk-rootfs-image-am335x-evm.tar.gz

kernel:  Linux am335x-evm 3.14.26-g2489c02 #1 Wed Feb 11 08:26:25 CST 2015 armv7l GNU/Linux (uname -a 打印)

代码是:

#include <unistd.h>
#include <stdio.h>
#include <pthread.h>


void Thread(void* param)
{
while(1)
{
printf("%d \n" , (int)param);
sleep(1);
}
}

int main()
{
pthread_t tid;
pthread_create(&tid , NULL , Thread , (void*)0);
pthread_create(&tid , NULL , Thread , (void*)1);
pthread_create(&tid , NULL , Thread , (void*)2);
pthread_create(&tid , NULL , Thread , (void*)3);
sleep(10000);
}

这里是编译方式:

arm-linux-gnueabihf-gcc test.c -lpthread -lm  -g -O0

这里是LOG:

root@am335x-evm:~# ./gdb a.out
GNU gdb (Linaro GDB) 7.6-2013.05
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<bugs.launchpad.net/.../>...
Reading symbols from /home/root/a.out...done.
(gdb) r
Starting program: /home/root/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 0xb6ff6470 (LWP 1486)]
0
[New Thread 0xb67f6470 (LWP 1487)]
1
[New Thread 0xb5ff6470 (LWP 1488)]
2
[New Thread 0xb57f6470 (LWP 1489)]
3
^C
Program received signal SIGINT, Interrupt.
0x4704f0b0 in nanosleep () from /lib/libc.so.6
(gdb) info thr
Id Target Id Frame
5 Thread 0xb57f6470 (LWP 1489) "a.out" 0x4704f0b0 in nanosleep ()
from /lib/libc.so.6
4 Thread 0xb5ff6470 (LWP 1488) "a.out" 0x4704f0b0 in nanosleep ()
from /lib/libc.so.6
3 Thread 0xb67f6470 (LWP 1487) "a.out" 0x4704f0b0 in nanosleep ()
from /lib/libc.so.6
2 Thread 0xb6ff6470 (LWP 1486) "a.out" 0x4704f0b0 in nanosleep ()
from /lib/libc.so.6
* 1 Thread 0xb6ff7000 (LWP 1483) "a.out" 0x4704f0b0 in nanosleep ()
from /lib/libc.so.6
(gdb) bt
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
#1 0x4704f0a4 in nanosleep () from /lib/libc.so.6
#2 0x00000000 in ?? ()
(gdb) thr 2
[Switching to thread 2 (Thread 0xb6ff6470 (LWP 1486))]
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
(gdb) bt
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
#1 0x4704f0a4 in nanosleep () from /lib/libc.so.6
#2 0x00000000 in ?? ()
(gdb) thr 3
[Switching to thread 3 (Thread 0xb67f6470 (LWP 1487))]
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
(gdb) bt
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
#1 0x4704f0a4 in nanosleep () from /lib/libc.so.6
#2 0x00000000 in ?? ()
(gdb)
#0 0x4704f0b0 in nanosleep () from /lib/libc.so.6
#1 0x4704f0a4 in nanosleep () from /lib/libc.so.6
#2 0x00000000 in ?? ()
(gdb) q

栈的函数调用信息显示的不完整,代码实际上没有啥问题。

谢谢,请问是平台问题?还是TI提供的文件系统问题(pthread库版本问题)?

只要使用线程就一定如此,不使用线程能够正常GDB调试。