2013年6月1日 星期六

[DDD] How debug by using DDD tool


[DDD] How debug by using DDD tool

1. Install DDD tool in the ubuntu 10.04

sudo apt-get install DDD

2.  Create a hello.c

Compile hello.c by using armeb-unknown-linux-uclibcgnueabi-gcc.

armeb-unknown-linux-uclibcgnueabi-gcc -g hello.c -o hello



Put hello to Embedded System.

Type gdbserver 192.168.x.x:12345 happy on the Embedded System.



3. Using DDD tool to debug

DDD  happy

target remote 192.168.x.x:12345



Pre Cont

(gdb) cont

Breakpoint 1, memory_violation () at happy.c:10

 





  %%%%%%%%%%%%%%%%%%%%%%%%%



The content of happy.c

#include <stdio.h>

//This function will cause "Segmentation fault"
void memory_violation()
{
char* ptr = 0;
for(int i=0; i<10; ++i)
{
ptr[i] = i;
}
}

int main(int argc, char* argv[])
{
memory_violation();
return 0;
}


%%%%%%%%%%%%%%%%%%%%%%%%%

Reference :



Related Posts:

0 意見:

張貼留言