最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - gdb finds most, but not all source files - Stack Overflow

programmeradmin2浏览0评论

For some reason, even with identical compilation directory, gdb is only finding a subset of sources files

As an example:

#12 0xb5bf6b90 in services::dcs::NetworkDomainCollector::addDomain (...) at services/collect/dcs_NetworkDomainCollector.cpp:19

and

#14 0xb5d7a610 in framework::dom::OCObject::OCObject (...) at **/home/jenkins/workspace/Official_Builds_Pipeline**/mclinux/src/framework/dom/dom_OCObject.h:66

Now for our codebase, our root directory we compile out of is mclinux, but I have realized recently that a good number of files(looking at .o/gcov files) show them being compiled out of mclinux/src/ so I thought maybe I just need to add ...mclinux and ...mclinux/src as 'directory' arguments, didn't make a difference.

#12 0xb5bf6b90 in services::dcs::NetworkDomainCollector::addDomain (...) at services/collect/dcs_NetworkDomainCollector.cpp:198
(gdb) info source
Current source file is services/collect/dcs_NetworkDomainCollector.cpp
Compilation directory is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src <== SAME
Located in /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/services/collect/dcs_NetworkDomainCollector.cpp <== gdb files this file!

#14 0xb5d7a610 in framework::dom::OCObject::OCObject (...) at /some/dir/mclinux/src/framework/dom/dom_OCObject.h:66
66      /some/dir/mclinux/src/framework/dom/dom_OCObject.h: No such file or directory
(gdb) info source
Current source file is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/framework/dom/dom_OCObject.h <== Naturally doesn't exist on my fs
Compilation directory is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src  <== SAME
<Not located by GDB>

Is there any command I can use to see if gdb even tried to search down these paths?

Even trying to totally short circuit it with things like

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/framework/dom/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/framework/dom/

or

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/

or

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/

For some reason, even with identical compilation directory, gdb is only finding a subset of sources files

As an example:

#12 0xb5bf6b90 in services::dcs::NetworkDomainCollector::addDomain (...) at services/collect/dcs_NetworkDomainCollector.cpp:19

and

#14 0xb5d7a610 in framework::dom::OCObject::OCObject (...) at **/home/jenkins/workspace/Official_Builds_Pipeline**/mclinux/src/framework/dom/dom_OCObject.h:66

Now for our codebase, our root directory we compile out of is mclinux, but I have realized recently that a good number of files(looking at .o/gcov files) show them being compiled out of mclinux/src/ so I thought maybe I just need to add ...mclinux and ...mclinux/src as 'directory' arguments, didn't make a difference.

#12 0xb5bf6b90 in services::dcs::NetworkDomainCollector::addDomain (...) at services/collect/dcs_NetworkDomainCollector.cpp:198
(gdb) info source
Current source file is services/collect/dcs_NetworkDomainCollector.cpp
Compilation directory is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src <== SAME
Located in /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/services/collect/dcs_NetworkDomainCollector.cpp <== gdb files this file!

#14 0xb5d7a610 in framework::dom::OCObject::OCObject (...) at /some/dir/mclinux/src/framework/dom/dom_OCObject.h:66
66      /some/dir/mclinux/src/framework/dom/dom_OCObject.h: No such file or directory
(gdb) info source
Current source file is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/framework/dom/dom_OCObject.h <== Naturally doesn't exist on my fs
Compilation directory is /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src  <== SAME
<Not located by GDB>

Is there any command I can use to see if gdb even tried to search down these paths?

Even trying to totally short circuit it with things like

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/framework/dom/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/framework/dom/

or

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/src/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/src/

or

set substitute-path /home/jenkins/workspace/Official_Builds_Pipeline/mclinux/ /home/user/mcgit/code/FMW-74565/coredumpout_16_29_52/mclinux/
Share Improve this question edited Feb 7 at 21:48 ks1322 35.7k14 gold badges117 silver badges171 bronze badges asked Feb 7 at 15:48 JoeManiaciJoeManiaci 4755 silver badges18 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 1

I'll answer my own question, playing around with substitue-path at the end, I realized that although the directories changed, the path that gdb prints when you execute 'bt' does not get updated with the new path. Not sure if that's considered a bug? But, if you go into the frame, you will see source data.

So lesson of the day, don't assume that substitute-path failed because 'bt' still shows the old path.

发布评论

评论列表(0)

  1. 暂无评论