[lldb-dev] How can lldb load an executable image to a remote bare-metal platform?
triple.yang at gmail.com
Wed Mar 12 20:40:13 PDT 2014
Hi, Greg. Sorry to bother you again.
I checked python API and found a path: SBDebugger -> SBTarget -> SBModule
-> SBSection to retrieve data and text sections which need to be uploaded
onto remote platform. The problem is I failed to figure out any method to
There is a python class named SBCommunication which I guess represents
remote debug connection, but I was not able to find an accessor to obtain
this object. Any clue?
And Since there are lots of kinds of debug operations (like memory write,
...) prohibitted without a valid process, and program image is needed to
launch a process, what is proper time to upload a image in your opinion?
(I have faked a process in debug server after process launch and before
image uploading and I force it to ignore the first continue/step packet,
thus it stops immediately when it lauches. I guess it will work, but lldb
displays ugly information at its first stop because memoey is all null.)
2014-03-07 7:01 GMT+08:00 Greg Clayton <gclayton at apple.com>:
> "image load" is for telling LLDB where a module is loaded. For example if
> you have an image foo.elf and you wanted to let LLDB know to set the load
> address for the image you could do:
> % lldb foo.elf --arch x86_64-unknown-unknown
> (lldb) image load foo.elf --slide 0
> this would cause LLDB to set all of the "load" addresses to match their
> "file" virtual addresses in the image, but it doesn't cause the image to be
> When LLDB is connected, it can write memory using a file:
> (lldb) memory --infile /tmp/foo.elf 0x10000
> This would write the entire file into memory, which probably isn't what
> you want. You probably want to obey the program headers in the ELF file and
> only load certain parts. You could certainly do this with a python command.
> See the "CREATE A NEW LLDB COMMAND USING A PYTHON FUNCTION" section on the
> http://lldb.llvm.org/python-reference.html web page for more details. But
> basically you could make a python command that would look at an ELF file
> and load it into a target at a given address.
> Or you could modify LLDB to add a command that would do this. If you want
> to go this route let me know as I will need to explain what would need to
> be done.
> On Mar 5, 2014, at 6:54 PM, 杨勇勇 <triple.yang at gmail.com> wrote:
> > Hi,
> > I ported lldb to debug on a remote bare-metal platform, and it basically
> works now.
> > But I do not find a way to load a program image to the remote bare-metal
> platform (just like "load" in gdb).
> > lldb has "image load" command but it does not work as expected since
> there is not any process
> > running.
> > Any suggestions?
> > Thanks in advance!
> > --
> > 杨勇勇 (Yang Yong-Yong)
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
杨勇勇 (Yang Yong-Yong)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev