-1
我希望使用gdb來調試程序。當我使用b lib.c:FUNCTION
設置斷點在lib.c
,GDB忽略斷點:如何使用GDB調試依賴文件?
Breakpoint 1 at 0x8048d03: file lib.c, line 120.
(gdb) run
Starting program: /home/jharvard/Dropbox/project/macro_main
usage: output file in rows of INT, INT, A or D
i.e. ./macro_main in/data_1
[Inferior 1 (process 14766) exited with code 01]
我覺得有可能是一些錯誤的Makefile文件。我該如何解決它?
CC?=gcc
CFLAGS+= -g -Wall
LDFLAGS=
LIBS = -lm
macro_main: macro_main.o lsm.o lib.o level.o
$(CC) $(LDFLAGS) -o [email protected] $^ $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c -o [email protected] $^
clean:
rm -rf *.o macro_main
編輯:下面是我得到的。可疑票據是Make breakpoint pending on future shared library load? (y or [n]) y
。這似乎表明在Makefile中沒有正確鏈接。
me (~/Dropbox/project): make
make: Warning: File `Makefile' has modification time 1.7e+06 s in the future
clang -Wall -c -o macro_main.o macro_main.c
clang -Wall -c -o lsm.o lsm.c
clang -Wall -c -o lib.o lib.c
clang -Wall -c -o level.o level.c
gcc -o macro_main macro_main.o lsm.o lib.o level.o -lm
make: warning: Clock skew detected. Your build may be incomplete.
me (~/Dropbox/project): gdb ./macro_main in/data_1
Reading symbols from ./macro_main...(no debugging symbols found)...done.
"/home/me/Dropbox/project/in/data_1" is not a core dump: File format not recognized
(gdb) b main
Breakpoint 1 at 0x8048685
(gdb) run
Starting program: /home/me/Dropbox/project/macro_main
Breakpoint 1, 0x08048685 in main()
(gdb) b lib.c:lsm_merge
No source file named lib.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (lib.c:lsm_merge) pending.
(gdb) continue
Continuing.
usage: output file in rows of INT, INT, A or D
i.e. ./macro_main in/data_1
[Inferior 1 (process 16156) exited with code 01]
確定程序不斷調用該函數? – immibis
gdb如何需要依賴文件?這會造成像Scons這樣的構建工具的麻煩,甚至不需要它們。 – Olaf
是的,當我運行'./macro_main in/data_1'時,它在函數中運行'printf'的內容。 – Pippi