- Upload gdbserver to Embedded Board
- Create a c file
- Upload program && Execute the gdbserver
- On the Local Machine
#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;
}
compile it.
-ggdb create symbol.
armeb-unknown-linux-uclibcgnueabi-gcc -ggdb -std=gnu99 -o hello hello.c
./gdbserver “embedded ip”:”embedded port” “program”
./gdbserver 111.6.1.191:12345 ./hello
./armeb-linux-gdb ./hello
When see (gdb), the type
target extended-remote 111.6.1.191:12345
Type run will see result appear on Embedded board
ddd –debugger /tmp/happy1/bin/armeb-linux-gdb /tmp/test2/hello –eval-command=”target extended-remote 111.6.1.191:12345”
Reference:
0 意見:
張貼留言