[lldb-dev] How can lldb load an executable image to a remote bare-metal platform?
gclayton at apple.com
Thu Mar 6 15:01:57 PST 2014
"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 downloaded.
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:
> 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
> Any suggestions?
> Thanks in advance!
> 杨勇勇 (Yang Yong-Yong)
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
More information about the lldb-dev