Debug/Log while file it’s looking for and where it’s looking.

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

Debug/Log while file it's looking for and where it's looking

问题

I'm using LLDB on mac and for certain files it's apparently not finding the source as I'm just getting a disassembly. Are there any settings that would help me figure out which file it's trying to find and where it's looking so I could figure out what source-map to define?

英文:

I'm using LLDB on mac and for certain files it's apparently not finding the source as I'm just getting a disassembly. Are then any settings that would help me figure out which file it's trying to find and where it's looking so I could figure out what source-map to define?

答案1

得分: 1

除非您已更改了帧格式设置,否则lldb在正常停止打印和回溯中都会打印源文件的基本名称。

因此,在停在具有调试信息但无法找到源文件的帧时,您将看到类似以下内容的信息:

帧#0:0x0000000100003f50 missing_file`main(argc = 1,argv = 0x000000016fdff140)位于 missing_file.c:9:3

但没有后续的源代码。

因此,您知道有源代码来自名为missing_file.c的文件,但lldb找不到它。如果要知道missing_file.c的完整路径,请执行:

(lldb)source info -f missing_file.c

它将显示完整路径,这是您需要的源映射。

如果这是一个更频繁的问题,您可以在“frame-format”设置中将“module.file.basename”与“module.file.fullname”交换。然后,当您停在一个帧时,您将立即看到源文件的完整路径。这不是默认设置,因为通常在停止时不需要完整路径,而且路径可能很长。

lldb目前没有“宣布找不到源文件搜索的喧闹模式”。很容易猜到发生了什么事情,并且在给定源名称的情况下找到完整路径也很简单。搜索也相当简单,它只咨询调试信息路径和“target.source-map”...

因此,没有人觉得需要从lldb获得有关搜索过程的更多详细信息。但是,如果您认为这是一个有价值的添加,请使用lldb问题跟踪器提交ER:

https://github.com/llvm/llvm-project/issues

或者,如果您感到有冒险的兴趣,可以尝试自己创建一些东西!

英文:

Unless you've changed your frame format setting, lldb prints the base-name of the source file both in the regular stop printing and in the backtrace.

So stopping in a frame that has a debug info but we can't find the source, you will see something like:

frame #0: 0x0000000100003f50 missing_file`main(argc=1, argv=0x000000016fdff140) at missing_file.c:9:3

but no following source.

So you know there's source that comes from file called missing_file.c which lldb can't find. If you want to know the full path to missing_file.c, do:

(lldb) source info -f missing_file.c

and it will show you the full path, which is what you need for the source map.

If this is a more frequent problem, you can swap module.file.basename with module.file.fullname in the frame-format setting. Then when you stop in a frame you'll see the full path to the source file immediately. This isn't the default setting because you don't usually need the full path when stopping, and paths can be long.

lldb doesn't currently have a "announce missing source files searches noisily" mode. It's pretty easy to guess what's going on, and finding the full path given the source name is also straight-forward. And the search is pretty simple, it only consults the debug info path, and the target.source-map...

So nobody has felt the need for more details from lldb about the search process. However, if this seems to you a worthwhile addition, please file an ER with the lldb issues tracker:

https://github.com/llvm/llvm-project/issues

or if you feel adventurous try whipping up something yourself!

huangapple
  • 本文由 发表于 2023年5月10日 15:18:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76215850.html
匿名

发表评论

匿名网友

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

确定