mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
added debugging method 'vmAddressFromLine'
This commit is contained in:
parent
862c37f9ad
commit
9681a8a1ff
@ -3009,3 +3009,29 @@ vmPrintTrace(Thread* t)
|
||||
|
||||
t->m->processor->walkStack(t, &v);
|
||||
}
|
||||
|
||||
// also for debugging
|
||||
void*
|
||||
vmAddressFromLine(Thread* t, object m, unsigned line)
|
||||
{
|
||||
object code = methodCode(t, m);
|
||||
printf("code: %p\n", code);
|
||||
object lnt = codeLineNumberTable(t, code);
|
||||
printf("lnt: %p\n", lnt);
|
||||
|
||||
if (lnt) {
|
||||
unsigned last = 0;
|
||||
unsigned bottom = 0;
|
||||
unsigned top = lineNumberTableLength(t, lnt);
|
||||
for(unsigned i = bottom; i < top; i++)
|
||||
{
|
||||
LineNumber* ln = lineNumberTableBody(t, lnt, i);
|
||||
if(lineNumberLine(ln) == line)
|
||||
return reinterpret_cast<void*>(lineNumberIp(ln));
|
||||
else if(lineNumberLine(ln) > line)
|
||||
return reinterpret_cast<void*>(last);
|
||||
last = lineNumberIp(ln);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user