[lldb-dev] Redefining functions
filcab at gmail.com
Mon Jul 18 13:32:05 PDT 2011
I'm trying to create an LLDB command that sets an internal breakpoint for a
function, and then executes some code, but I'm having come difficulties...
I've seen the expression command, which does something close to what I want
to do after the breakpoint, but I have some doubts. I want the code to be
able to return from the function where it's called, but the "
target->EvaluateExpression" doesn't let the code return from it (while I
would like to execute code with something like "if (condition) return NULL;
more code…"). Is there a way to compile arbitrary code (with return
statements) and execute it?
Is there a way to create something like an anonymous function (with certain
parameters), and have it compiled and linked, while looking up global
variables? ClangUtilityFunction doesn't look up any variables, and I can't
seem to find a way to look up global variables without a Frame object.
Is there a way to know a function (or method)'s address from its prototype?
My final purpose is to be able to redefine functions on-the-fly (with
caveats for inlined functions, etc). The only way I saw that could work was
creating a (similar) function and making the other function a trampoline
(either using breakpoints, or writing a jmp expression at its address)… Did
I miss another easier way?
Thanks for the help,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev