addr2line – 在基本示例上失败

huangapple go评论89阅读模式
英文:

addr2line - fails on basic example

问题

It appears you're looking for a code review or assistance with an issue, but your request doesn't specify what exactly you need help with. Could you please provide more context or clarify your question?

英文:
  1. #include <stdio.h>
  2. void __cyg_profile_func_enter(void *func, void *caller) __attribute__((no_instrument_function));
  3. void __cyg_profile_func_exit(void *this_fn, void *call_site) __attribute__((no_instrument_function));
  4. void __cyg_profile_func_enter(void *func, void *caller)
  5. {
  6. printf("%p\n", func);
  7. printf("%p\n", caller);
  8. }
  9. void __cyg_profile_func_exit(void *this_fn, void *call_site)
  10. {
  11. }
  12. void my_function(int a, int b)
  13. {
  14. a = a * b;
  15. }
  16. void dummy_function()
  17. {
  18. int a = 10;
  19. int b = 20;
  20. my_function(a, b);
  21. }
  22. int main()
  23. {
  24. int x = 42;
  25. int y = 73;
  26. dummy_function();
  27. my_function(x, y);
  28. return 0;
  29. }

Build commands:

  1. gcc -x c boost_stacktrace.cpp -finstrument-functions -rdynamic -g -O0 -o boost_stacktrace.exe
  2. ./boost_stacktrace.exe | tee addrs.txt
  3. 0x55d97d38324c
  4. 0x7f0fa12b0d90
  5. 0x55d97d3831f4
  6. 0x55d97d383287
  7. 0x55d97d3831a9
  8. 0x55d97d383233
  9. 0x55d97d3831a9
  10. 0x55d97d383296
  11. addr2line -e boost_stacktrace.exe -f -i -p < addrs.txt
  12. ?? ??:0
  13. ?? ??:0
  14. ?? ??:0
  15. ?? ??:0
  16. ?? ??:0
  17. ?? ??:0
  18. ?? ??:0
  19. ?? ??:0

QUESTION
What am I doing wrong?

答案1

得分: 2

After I added -no-pie to my compile command, it worked.

英文:

After I added -no-pie to my compile command, it worked.

huangapple
  • 本文由 发表于 2023年4月11日 00:41:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75978924.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定