1

同じ名前のグローバルを持つ 2 つのソース ファイル (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。のような複製の 1 つを印刷しようとするとm_user_array_size、gdb は教えてくれますが、No symbol "m_user_array_size" in current context.印刷するapp_gpiote_user_enableと、gdb はそれに満足します。

  1. gdbで重複したシンボルを出力するにはどうすればよいですか? シンボルの代わりにアドレスを使用する必要がありますか?
  2. .5782重複記号の末尾にある などの数字は何ですか? シンボルをオブジェクト ファイルにマップし直すのに役立ちますか?

注:変数の名前を変更するだけではなく、両方ともサードパーティのライブラリで定義されています。

4

1 に答える 1