Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the discover path for lldb in xcode

I have a program built in one environment and I want to debug it in my own environment. I have copied executable, .dSYM and the source code but I can't find ways to let lldb know where to find the source code.

For example, in the building environment there are source files:

/build_src/rel_path/source1.c
/build_src/rel_path/source1.dSYM
/build_src/rel_path/app1

And in my environment the files and .dSYM are copied to:

/source/rel_path/source1.c
/source/rel_path/source1.dSYM
/source/rel_path/app1

Is there any way to set the discover path or any other way to remap the source code path?

like image 716
user4187988 Avatar asked Nov 02 '14 23:11

user4187988


1 Answers

That's what the "target.source-map" setting is for:

(lldb) settings list target.source-map
  source-map -- Source path remappings used to track the change of location between a source file when built, and where it exists on the current system. 
                It consists of an array of duples, the first element of each duple is some part (starting at the root) of the path to the file when it
                was built, and the second is where the remainder of the original build hierarchy is rooted on the local system.  Each element of the
                array is checked in order and the first one that results in a match wins.

So for instance in your case you would do:

settings set target.source-map /build_src /source

lldb has an apropos command you can use to find these sort of buried goodies, so for instance apropos source would have shown you the help above, as well as a pretty short list of other things.

like image 70
Jim Ingham Avatar answered Oct 02 '22 23:10

Jim Ingham