<meta charset="utf-8"><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 13px; ">Hi,<div><br></div><div>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...</div>
<div><br></div><div>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 "<span style="font-family: Menlo; font-size: 11px; ">target->EvaluateExpression</span>" 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?</div>
<div><br></div><div>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.</div>
<div><br></div><div>Is there a way to know a function (or method)'s address from its prototype?</div><div><br></div><div>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?</div>
<div><br></div><div>Thanks for the help,</div><div><br clear="all"> Filipe</div><div><br></div></span>