我以前工作的代码现在崩溃了。核心转储指向被调用的构造函数。 我试图获得bt,bt full和disassembly。我需要一些帮助来总结在调用构造函数时可能导致分段错误的原因? 代码在QNX上运行,只有控制台gdb。局部变量都是0,这意味着什么?
这是o / p:
(gdb) bt
#0 0x481a95b0 in notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID (path_Type=PATH_NULL, pathId=1215822164,
alarm_Id=DS3_PATH_IDLE_ID) at /vob/qnx/cema-common/msg/PathObjMsg.h:47
(gdb) bt full
#0 0x481a95b0 in notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID (path_Type=PATH_NULL, pathId=1215822164,
alarm_Id=DS3_PATH_IDLE_ID) at /vob/qnx/cema-common/msg/PathObjMsg.h:47
msg = {<Message> = {msgSource = MSG_SOURCE_INVALID, msgPriority = MSG_PRIO_LOW, msgLength = 0},
msgType = MSG_PATH_ALARM, pathType = PATH_NULL, pathId = {bay = 0 '\0', line = 0 '\0', path = {stsn = {
sts1Num = 0 '\0'}, vt = {sts1Num = 0 '\0', isTu3 = 0 '\0', tug3Num = 0 '\0', vtgTug2Num = 0 '\0',
vtTuNum = 0 '\0'}, ds3 = {sts1Num = 0 '\0', ds3Num = 0 '\0'}, ds1InDS3Line = {pad = 0 '\0', ds1Num = 0 '\0'},
ds1InVT = {sts1Num = 0 '\0', pad = 0 '\0', tug3Num = 0 '\0', vtgTug2Num = 0 '\0', vtTuNum = 0 '\0'},
ds1InDS3Path = {sts1Num = 0 '\0', tug3Num = 0 '\0', ds1Num = 0 '\0'}, e1InVT = {sts1Num = 0 '\0', pad = 0 '\0',
tug3Num = 0 '\0', vtgTug2Num = 0 '\0', vtTuNum = 0 '\0'}, e3 = {sts1Num = 0 '\0', ds3Num = 0 '\0'}}},
alarmId = 0, lineId = 0 '\0'}
emPathType = PATH_NULL
emAlarmId = 10
(gdb) l * 0x481a95b0
0x481a95b0 is in notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID (/vob/qnx/cema-common/msg/PathObjMsg.h:47).
42 PathObjMsg(
43 PATH_TYPE pathTypeIn,
44 EM_PATH_ID pathIdIn,
45 PATH_OBJ_MSG_TYPE msgTypeIn,
46 EM_PATH_ALARM_ID alarmIdIn
**47 ): Message(MSG_SOURCE_PATH_OBJ)**
48 {
49 pathType = pathTypeIn;
50 pathId = pathIdIn;
51 msgType = msgTypeIn;
反汇编的O / p:
bne- 0x481a962c <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+264>
0x481a959c <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+120>: li r0,15
0x481a95a0 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+124>: mr r27,r28
0x481a95a4 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+128>: stw r27,88(r1)
0x481a95a8 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+132>: stw r0,8(r1)
0x481a95ac <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+136>: addi r31,r1,8
0x481a95b0 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+140>: li r9,1
0x481a95b4 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+144>: stw r9,4(r31)
0x481a95b8 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+148>: stw r29,16(r31)
0x481a95bc <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+152>: lwz r0,88(r1)
0x481a95c0 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+156>: stw r9,12(r31)
0x481a95c4 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+160>: stw r0,20(r31)
0x481a95c8 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+164>: stw r5,24(r31)
0x481a95cc <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+168>: lbz r0,89(r1)
0x481a95d0 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+172>: mr r3,r31
0x481a95d4 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+176>: stb r0,28(r31)
0x481a95d8 <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+180>: li r4,32
0x481a95dc <notifyDs3PathAlarmClrEvent__F9PATH_TYPEUi17DS3_PATH_ALARM_ID+184>:
答案 0 :(得分:0)
我以前工作的代码现在崩溃了。核心转储指向 正在调用构造函数。我试图获得bt,bt full和 拆卸。我需要一些帮助才能得出结论 调用构造函数时出现分段错误?代码在QNX上运行 只有控制台gdb。局部变量都是0,可能是什么 那是什么意思?我需要一些帮助才能得出结论 调用构造函数时出现分段错误?
请不要断定在调用构造函数时可能存在问题(仅限)。这个可以 只是已经发生的其他事情(坏事)的副作用。这很难 从当前的堆栈跟踪中找出问题。有时内存错误会很多 间歇性的(由于输入/线程的不同/执行顺序的变化),程序可能会运行多年而不会出现任何问题的症状。 本地变量0可能表示它看起来没问题,但我们无法从中得出任何结论。
我确实认为可能存在一些内存损坏方案(在其他模块中的其他位置)导致此崩溃。您必须使用 GDB / Valgrind (某些动态工具)调试代码以找出根问题。看起来您在QNX上遇到此问题,因此您可能希望运行Valgrind来识别代码中的问题。你可以参考我以前的帖子