GDB - 找不到调试符号 -

时间:2016-09-18 17:29:30

标签: c++ linux compilation gdb

所以我正在托管一个8.6的OpenTibia-Server。有时服务器冻结,我不知道是什么导致它冻结,所以我让我的朋友帮助我,他告诉我用gdb选项编译控制台。我做到了。但是当我在冻结后将控制台连接到GDB时,它表示没有找到调试符号。我也添加了选项-g-s(第6行),但它不起作用。

这是我的Makefile.am:

noinst_PROGRAMS = theforgottenserver

CXXFLAGS = -pipe -std=gnu++11
AM_CXXFLAGS = $(XML_CPPFLAGS) $(OTSERV_FLAGS) $(LUA_CFLAGS) $(DEBUG_FLAGS)\
$(MYSQL_FLAGS) $(SQLITE_FLAGS) $(PGSQL_FLAGS) $(PROFILER_FLAGS)\
$(OPTIONAL_FLAGS) -D_THREAD_SAFE -D_REENTRANT -Wall -Wextra -Wno-strict-aliasing -llua5.1 -I/usr/include/lua5.1 -g -s

theforgottenserver_LDADD = $(LUA_LIBS)

if USE_MYSQL
MAYBE_MYSQL = databasemysql.cpp databasemysql.h
endif
if USE_SQLITE
MAYBE_SQLITE = databasesqlite.cpp databasesqlite.h
endif
if USE_PGSQL
MAYBE_PGSQL = databasepgsql.cpp databasepgsql.h
endif
if LOGIN_SERVER
MAYBE_LOGIN = gameservers.cpp gameservers.h
endif
if OT_ADMIN
MAYBE_OTADMIN = admin.cpp admin.h
endif

theforgottenserver_SOURCES = account.h actions.cpp actions.h $(MAYBE_OTADMIN) \
        allocator.cpp allocator.h baseevents.cpp baseevents.h beds.cpp \
        beds.h chat.cpp chat.h combat.cpp combat.h condition.cpp condition.h \
        config.h configmanager.cpp configmanager.h connection.cpp connection.h \
        const.h container.cpp container.h creature.cpp creature.h \
        creatureevent.cpp creatureevent.h cylinder.cpp cylinder.h database.cpp \
        database.h databasemanager.cpp databasemanager.h $(MAYBE_MYSQL) \
        $(MAYBE_SQLITE) $(MAYBE_PGSQL) depot.cpp depot.h dispatcher.cpp \
        dispatcher.h exception.cpp exception.h fileloader.cpp fileloader.h \
        game.cpp game.h $(MAYBE_LOGIN) globalevent.cpp globalevent.h group.cpp \
        group.h house.cpp house.h housetile.cpp housetile.h ioban.cpp ioban.h \
        ioguild.cpp ioguild.h iologindata.cpp iologindata.h iomap.cpp iomap.h \
        iomapserialize.cpp iomapserialize.h item.cpp item.h itemattributes.cpp \
        itemattributes.h items.cpp items.h luascript.cpp luascript.h \
        mailbox.cpp mailbox.h manager.cpp manager.h map.cpp map.h monster.cpp \
        monster.h monsters.cpp monsters.h movement.cpp movement.h \
        networkmessage.cpp networkmessage.h npc.cpp npc.h otpch.h otserv.cpp \
        otsystem.h outfit.cpp outfit.h outputmessage.cpp outputmessage.h \
        party.cpp party.h player.cpp player.h position.cpp position.h \
        protocol.cpp protocol.h protocolgame.cpp protocolgame.h \
        protocolhttp.cpp protocolhttp.h protocollogin.cpp protocollogin.h \
        protocolold.cpp protocolold.h quests.cpp quests.h raids.cpp raids.h \
        rsa.cpp rsa.h scheduler.cpp scheduler.h scriptmanager.cpp \
        scriptmanager.h server.cpp server.h spawn.cpp spawn.h spells.cpp \
        spells.h status.cpp status.h talkaction.cpp talkaction.h teleport.cpp \
        teleport.h templates.h textlogger.cpp textlogger.h thing.cpp thing.h \
        tile.cpp tile.h tools.cpp tools.h town.h trashholder.cpp trashholder.h \
        waitlist.cpp waitlist.h waypoints.h weapons.cpp weapons.h vocation.cpp \
        vocation.h

以下是我在附加GDB并运行bt时在终端上获得的内容 enter image description here

1 个答案:

答案 0 :(得分:0)

  

我添加了选项-g和-s

-g选项告诉编译器发出调试信息。

-s选项告诉链接器删除(剥离)调试信息。你想要那个选项。

您还需要附加到正确的流程(而不是您附加的screen)。一旦您附加了正确的进程,您将需要发出(gdb) thread apply all where命令,该命令的完整输出可能允许熟悉OpenTibia的人诊断死锁。

注意:您实际上并不需要OpenTibia Server的调试版本:即使没有调试信息,thread apply all where的输出也可能指向问题。