gdb和valgrind在一个makefile中 [英] gdb and valgrind within a makefile

查看:137
本文介绍了gdb和valgrind在一个makefile中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常基本的问题。我在这里看过像 http://www.cs.cmu.edu/~gilpin / tutorial / ,但仍然怀疑。

I have a very basic question. I did look around like over here http://www.cs.cmu.edu/~gilpin/tutorial/ but still doubtfull..

考虑下面的makefile(也在前面的问题中给出过)

Consider the following makefile(had also given it in a previous question)

all: clients.so simulator backup  
   LD_PRELOAD=/home/Juggler/client/clients.so ./simulator  
backup: backup.c libclient.a
   gcc backup.c -o backup -L /home/Juggler/client -L. -lclient -ldl 
simulator: simulator.c libclient.a     
   gcc -g simulator.c -o simulator -L /home/Juggler/client -L. -lclient -ldl -pthread
libclient.a: libclient.o client.o     
   ar rcs libclient.a libclient.o client.o 
libclient.o:libclient.c
   gcc -c libclient.c -o libclient.o -pthread  
clients.so: client.o client_invoke.o     
   ld -shared -o clients.so client_invoke.o client.o -ldl 
client_invoke.o: client_invoke.c     
   gcc -Wall -fPIC -DPIC -c -g client_invoke.c 
client.o: client.c
   gcc -Wall -fPIC -DPIC -c -g client.c -ldl -pthread 

使用gdb或Valgrind的。事实上,我在做make时遇到了分段错误,并且想要调试。但是我从来没有在makefile中使用gdb或valgrind

What do I do/change to debug using either gdb or valgrind. Actually I am getting a segmentation fault while doing make and would like to debug. But I have never used gdb or valgrind from within a makefile

谢谢

Thanks

推荐答案

我对你的演示文稿做了一个小小的编辑。您最初写了

I made a small edit to your presentation. You originally wrote

client.o: client.c     gcc -Wall -fPIC -DPIC -c -g client.c -ldl -pthread 

您可以将它更改为新窗体并查看是否生成段错误?

Can you change it to the new form and see if make segfaults?

这篇关于gdb和valgrind在一个makefile中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆