GDB使用

编译: gcc -o pwm_with_gdb pwm1.c -g

 

gdb

GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04

Copyright (C) 2012 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

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 "i686-linux-gnu".

For bug reporting instructions, please see:

.

(gdb)

 

file pwm_with_gdb

(gdb) file pwm_with_gdb

Reading symbols from /work/projects/335x/kernel_3.14.43/test/pwm/pwm_with_gdb...done.

 

r (run)

Starting program: /work/projects/335x/kernel_3.14.43/test/pwm/pwm_with_gdb

Usage: ./pwm_test (0 ~ 100)

Program received signal SIGSEGV, Segmentation fault.

0xb7e84d2e in rewind () from /lib/i386-linux-gnu/libc.so.6

 

bt (backtrace)

#0 0xb7e84d2e in rewind () from /lib/i386-linux-gnu/libc.so.6

#1 0x0804850e in pwm_request () at pwm1.c:28

#2 0x080486d0 in main (argc=1, argv=0xbffff634) at pwm1.c:108

 

frame 1

(gdb) frame 1

#1 0x0804850e in pwm_request () at pwm1.c:28

28 rewind(fp);

 

print fp

(gdb) print fp

$1 = (FILE *) 0x0

 

quit

(gdb) quit

A debugging session is active.

Inferior 1 [process 22610] will be killed.

Quit anyway? (y or n) y

你可能感兴趣的:(am335x)