Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show Full File Path of Source File When Stepping through Code in lldb

Tags:

lldb

When I step through my code in lldb, there will be an indication of the source file name:

(lldb) s
Process 23824 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
    frame #0: 0x00000001000073b2 clang`llvm::SmallVector<std::__1::pair<void*, unsigned long>, 0u>::SmallVector(this=0x00007ffeefbff080) at SmallVector.h:843

So I can see here we are at line 843 on SmallVector.h.

However, I do not know what's the full file path of this file and I am forced to use Terminal's find to find it. And it becomes a problem if there's more than one file with the same name.

Is there a setting I can change so lldb will dump the full file path?

like image 408
forgodsakehold Avatar asked Oct 24 '25 15:10

forgodsakehold


1 Answers

If you only want one-time printing of this information, you can use the source info command to dump info about a source file. For instance:

(lldb) source info -a $pc

will dump the full path to the source file at the current pc (among other things).

If you want to see full paths in backtraces all the time, you can adjust the lldb setting frame-format which controls the frame printing in backtraces. See:

https://lldb.llvm.org/use/formatting.html

for more details. In your case you want:

settings set frame-format frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{\`${function.name}}}{ at ${line.file.fullpath}:${line.number}}\n

Use settings show frame-format to see the default setting.

like image 191
Jim Ingham Avatar answered Oct 28 '25 04:10

Jim Ingham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!