http://llvm.org/bugs/show_bug.cgi?id=22211
Bug ID: 22211
Summary: Can't easily call a function in a binary without debug
information, even if I can break on it
Product: lldb
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
I'd like to easily be able to attach lldb to a Firefox Nightly build and call a
function called mozilla_sampler_save_profile_to_file, like this:
> (lldb) print
> (void)mozilla_sampler_save_profile_to_file("/Users/mstange/Desktop/profile.txt")
But since this binary doesn't come with debugging information, lldb gives me an
error:
> error: use of undeclared identifier 'mozilla_sampler_save_profile_to_file'
It can, however, break on the function:
> (lldb) b mozilla_sampler_save_profile_to_file
> Breakpoint 1: where = XUL`mozilla_sampler_save_profile_to_file(char const*),
> address = 0x000000010253d2a0
As a user of lldb, I can now take that address, cast it to a function pointer,
and call the function through that pointer:
> (lldb) p ((void(*)(const
> char*))0x000000010253d2a0)("/Users/mstange/Desktop/profile.txt")
Or, instead of copy-pasting the address, I can do a little scripting:
> (lldb) script
> Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
> >>> lldb.debugger.HandleCommand('print ((void(*)(const
> >>> char*))0x%0x)("/Users/mstange/Desktop/profile.txt")' %
> >>> lldb.target.FindFunctions("mozilla_sampler_save_profile_to_file").symbols[0].addr.load_addr)
It would be nice if lldb could simplify this process for me. It knows the
address of the function already, and it could theoretically derive the argument
types from the demangled function name.
In https://bugzilla.mozilla.org/show_bug.cgi?id=1118228 I'm adding a user
defined lldb function called 'callfunc' to the lldb helpers that are included
in the Firefox source, which makes this a little easier.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev