我有两个源文件(在C中),它们具有同名的全局文件。球体是静止的。如果我使用nm从对象文件中转储符号,我可以看到包含了调试信息:
hostname:ble_app_hrs username$ find Debug -name '*.o' -exec /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi-nm -o -l {} \; | grep m_user_array_size
Debug/components/libraries/gpiote/app_gpiote.o:00000000 b m_user_array_size GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/gpiote/app_gpiote.c:36
Debug/components/libraries/timer/app_timer.o:00000000 b m_user_array_size GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/timer/app_timer.c:131但是,如果我在链接完成后从ELF文件中转储符号,那么这些重复符号的调试信息就会被删除。这是正常的行为.这里所描述的是自动发生的吗?
hostname:ble_app_hrs username$ /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi-nm -o -l Debug/ble_app_hrs.elf | grep user
Debug/ble_app_hrs.elf:0001cb50 T app_gpiote_user_enable GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/gpiote/app_gpiote.c:224
Debug/ble_app_hrs.elf:0001ca88 T app_gpiote_user_register GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/gpiote/app_gpiote.c:190
Debug/ble_app_hrs.elf:200020a4 B m_enabled_users_mask.6444
Debug/ble_app_hrs.elf:200020c0 B m_gpiote_user_id.6603
Debug/ble_app_hrs.elf:20002080 B m_user_array_size.5782
Debug/ble_app_hrs.elf:200020a8 B m_user_array_size.6446
Debug/ble_app_hrs.elf:200020a9 B m_user_count.6445
Debug/ble_app_hrs.elf:20002084 B mp_users.5783
Debug/ble_app_hrs.elf:200020ac B mp_users.6443
Debug/ble_app_hrs.elf:0001d688 t user_id_get.5752.4484 GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/timer/app_timer.c:1056
Debug/ble_app_hrs.elf:0001d2cc t user_op_alloc.5716.4521 GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/timer/app_timer.c:794
Debug/ble_app_hrs.elf:0001d2b4 t user_op_enque.5691.4546 GNU_ARM_Eclipse/nRF51_SDK_7/components/libraries/timer/app_timer.c:781注意,并不是所有的调试信息都被删除了--它仍然存在于像app_gpiote_user_enable这样的符号中。如果我尝试打印一个副本,如m_user_array_size,gdb告诉我,No symbol "m_user_array_size" in current context.,但是,如果我打印app_gpiote_user_enable,gdb对此很满意。
.5782等数字是什么?这能帮我把符号映射回目标文件吗?注意:我不只是重命名变量--它们都是在第三方库中定义的。
发布于 2015-01-12 07:56:44
重复符号打印如下:p 'f2.c'::x。解释为在GDB手册的这一节。
使用address进行打印可以这样做(假设0x60103c是整数变量的地址):
print *(int*)0x60103c只有在使用-flto标志构建可执行文件时,我才在符号末尾看到数字。这(对于默认的Ubuntu14.04工具链)也破坏了gdb从其他文件打印符号的能力(它打印错了一个)。解决这一问题的方法之一是在调试时不使用-flto构建。
https://stackoverflow.com/questions/27866865
复制相似问题