LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1148|回复: 11

gdb调试只能调试部分函数,为什么?

[复制链接]
发表于 2005-11-9 16:41:55 | 显示全部楼层 |阅读模式
100多个源代码文件,有些函数调用gettext,SDL,freetype,freeWnn,自制的*.a
用g++编译,带 -g 参数。
main开始部分能单步跟踪,但是有些函数根本进不去,而且还next也过不去。
什么问题?
 楼主| 发表于 2005-11-10 11:18:37 | 显示全部楼层
好像有些人认为是因为是没有带 -g.
如果问题这么简单就不会发提问了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-10 11:19:22 | 显示全部楼层
#这是Makefile
#问题是同一个文件有些函数能调试,有些函数调试不通
INSTROOT=../../../editor
LOCALEDIR=/usr/local/castedit/locale
PENTIUM=pentium3-
CROSS=$(PENTIUM)
CC = $(CROSS)g++
CHMOD = chmod
OBJECTS = AFDocument.o AFSheet.o AFElement.o AFText.o AFCharAttr.o AFString.o \
AFLine.o AFGroup.o \
AFFont.o AFView.o AFPartDoc.o \
AFPartButton.o AFPartEditBox.o AFPartPulldown.o AFSJ3List.o \
AFPartSlider.o AFPartGraList.o AFPartList.o AFPartPopup.o AFPartLabel.o \
AFDialogMsg.o AFParam.o \
AFCreateCommandPart.o AFCommand.o AFCmdFile.o AFCmdProperty.o AFCmdEtc.o \
AFCmdExport.o AFCmdColor.o AFCmdView.o \
AFCreateToolPart.o AFTool.o AFEditTool.o AFSelectTool.o \
AFDropTool.o AFLineTool.o \
AFSelect.o AFUndo.o AFCapture.o AFColor.o AFBackground.o \
AFApp.o AFArchive.o AFVersion.o \
AFUtility.o AFExport.o AFException.o \
AFKeybind.o AFContext.o AFConverter.o AFKeyCommand.o \
AFFileDialog.o AFFontDialog.o AFWarning.o AFSwitchDialog.o AFWait.o \
signal_handler.o AFLangInfo.o
SJ3_LIBDIR = /usr/local/lib
SJ3_HDRDIR = /usr/local/include

ifeq ($(CROSS),$(PENTIUM))
# export PATH=${PATH}:/opt/hardhat/devkit/x86/pentium3/bin/
# TARGETROOT= /tftpboot/target
SDL_HDRDIR= $(TARGETROOT)/usr/local/include/SDL
SDL_LIBDIR= $(TARGETROOT)/usr/local/lib
SDL_LIBS = -L$(SDL_LIBDIR) -Wl,-rpath,$(SDL_LIBDIR) -lSDL -lpthread
SDL_CFLAGS = -I$(SDL_HDRDIR) -D_REENTRANT
CFLAGS = -DNDEBUG -DMPU -D_GLIBCPP_USE_WCHAR_T -D_I18N
CFLAGS += -I$(TARGETROOT)/usr/local/include/freetype2
else
SDL_LIBS =`sdl-config --libs`
SDL_CFLAGS =`sdl-config --cflags`
CFLAGS = -D_I18N
CFLAGS += -I/usr/local/include/freetype2
CFLAGS += `freetype-config --cflags`
endif
CFLAGS += $(SDL_CFLAGS) -I$(SJ3_HDRDIR)
CFLAGS += -I../../modules/gpio -I$(TARGETROOT)/usr/local/include
CFLAGS += -I../../include
LIBS = $(SDL_LIBS) -L$(SJ3_LIBDIR)
LIBS += -lAnycast_com -lmtools -lnsl

.cpp.o:
$(CC) -g -c -Wall -O2 ${CFLAGS} -o $@ $<

all : editor

editor: main.cpp $(OBJECTS)
$(CC) -g -Wall -O2 -fPIC main.cpp -o $@ \
$(OBJECTS) \
${CFLAGS} ${LIBS} \
-lfreetype \
-lime -lcrypt \
-lGDL -lSDL_draw -lSDL_image -lSDL_ttf -ltiff -lm\
-ljctype

depend:
makedepend -- $(CFLAGS) \
-I/usr/local/include/g++-3 \
-I/usr/include/c++/3.2.3 -I/usr/include/c++/3.2.3/backward \
-- *.c *.cpp
clean:
rm -f *.o
rm -f editor

install: all
install -d ${INSTROOT}/bin
install -d ${INSTROOT}/gdlfont
install -d ${INSTROOT}/etc
install -d ${INSTROOT}/bmp
-cp -r -f ../editor/bmp/* $(INSTROOT)/bmp/
install editor ${INSTROOT}/bin
install ../editor/bin/editor ${INSTROOT}/bin
install ../editor/bin/editorFactorySet ${INSTROOT}/bin
install ../editor/editor.ini ${INSTROOT}/etc
install ../editor/etc/sjrk ${INSTROOT}/etc
install ../editor/etc/version ${INSTROOT}/etc
install ../editor/gdlfont/*.dat ${INSTROOT}/gdlfont
install -d /castedit/editor/ttf
install ../editor/ttf/*.TTF /castedit/editor/ttf
install ../editor/ttf/*.ttf /castedit/editor/ttf
install ../editor/ttf/*.TTC /castedit/editor/ttf

# (dependency)
# DO NOT DELETE THIS LINE -- make depend depends on it.
AFDocument.o: AFDocument.h AFTypes.h AFVersion.h AFObject.h AFView.h AFUndo.h
AFSheet.o: AFSheet.h AFTypes.h AFObject.h AFView.h
AFElement.o: AFElement.h AFTypes.h AFObject.h
AFText.o: AFText.h AFTypes.h AFObject.h AFElement.h AFView.h AFCharAttr.h AFString.h AFFont.h
AFLine.o: AFLine.h AFTypes.h AFObject.h AFElement.h AFView.h
AFCharAttr.o: AFCharAttr.h AFTypes.h AFObject.h AFUtility.h AFLangInfo.h
AFString.o: AFString.h AFTypes.h AFLangInfo.h
AFFont.o: AFFont.h AFTypes.h
AFView.o: AFView.h AFTypes.h
AFPartDoc.o: AFPart.h AFTypes.h AFLangInfo.h
AFUtility.o: AFUtility.h AFTypes.h
AFPartButton.o: AFPart.h gdlxDef.h AFTypes.h
AFPartEditBox.o: AFPart.h gdlxDef.h AFTypes.h
AFPartPulldown.o: AFPartPulldown.h gdlxDef.h AFTypes.h
AFPartSlider.o: AFPart.h AFTypes.h
AFCreateCommandPart.o: AFPart.h AFTypes.h AFConverter.h
AFCreateToolPart.o: AFPart.h AFTypes.h
AFCommand.o: AFCommand.h AFTypes.h AFUndo.h
AFTool.o: AFTool.h AFTypes.h AFView.h AFConverter.h
AFEditTool.o: AFEditTool.h AFTool.h AFTypes.h AFContext.h AFConverter.h
AFSelectTool.o: AFSelectTool.h AFTool.h AFTypes.h AFUndo.h
AFMoveTool.o: AFMoveTool.h AFTool.h AFTypes.h AFUndo.h
AFSelect.o: AFSelect.h AFTypes.h AFConverter.h
AFApp.o: AFApp.h AFTypes.h AFConverter.h AFCmds.h AFSelectTool.h AFUndo.h
AFArchive.o: AFArchive.h AFTypes.h AFDocument.h AFSheet.h AFText.h AFGroup.h
AFVersion.o: AFVersion.h AFObject.h AFTypes.h
AFKeybind.o: AFKeybind.h AFContext.h
AFContext.o: AFContext.h
AFConverter.o: AFConverter.h
AFKeyCommand.o: AFConverter.h AFKeybind.h AFContext.h AFConverter.h
AFException.o: AFException.h
AFWarning.o: AFDialogs.h AFTypes.h AFPart.h AFUtility.h
AFCmdFile.o: AFCmds.h
AFCmdProperty.o: AFCmds.h
AFCmdEtc.o: AFCmds.h AFGroup.h
AFCmdView.o: AFCmds.h AFCapture.h AFBackground.h
AFBackground.o: AFBackground.h
AFCapture.o: AFCapture.h
AFUndo.o: AFDocument.h AFText.h AFApp.h AFUtility.h AFSelect.h
AFGroup.o: AFElement.h AFView.h AFSheet.h AFUtility.h
AFLangInfo.o: AFLangInfo.h
signal_handler.o: signal_handler.h
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-10 11:21:10 | 显示全部楼层
可能的问题是
1)有些源代码文件太大
2)函数内部有#ifdef等宏定义
3)c和c++共存。
哪位高人指点指点?
回复 支持 反对

使用道具 举报

发表于 2005-11-10 17:02:32 | 显示全部楼层
去掉-O
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-14 11:51:56 | 显示全部楼层
好像不行
回复 支持 反对

使用道具 举报

发表于 2005-11-15 09:53:07 | 显示全部楼层
gdb只能跟踪加入调试信息的程序,我看你程序只像gettext这些函数并不是你自己实现的,而是用库的,这些库在发行时并没有加入高度信息啊!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-16 12:59:04 | 显示全部楼层
对阿,现在问题是我自己的写的函数进不去.
比如现在的问题是,我在main.cpp里加了aaa(),bbb()函数,aaa()能进去,但是这个bbb()怎么弄也进不去。
现在的做法只能是追加printf来打出信息了。
回复 支持 反对

使用道具 举报

发表于 2005-11-17 21:58:47 | 显示全部楼层
gettext好象是GNU定义的宏吧?
回复 支持 反对

使用道具 举报

发表于 2005-11-19 12:52:54 | 显示全部楼层
Post by kj501
gettext好象是GNU定义的宏吧?



这个没仔细看过!!

不过像这样的情况好像还没见过耶!!加入了调试信息了,gdb无法跟踪!!

你break bbb()了吗
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表