mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Add a new client request, VALGRIND_MAP_IP_TO_SRCLOC, so that clients
can query their own debug info. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11269
This commit is contained in:
parent
9a8dd3161a
commit
3195fb3d5d
@ -1546,6 +1546,35 @@ void do_client_request ( ThreadId tid )
|
||||
SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
break;
|
||||
|
||||
case VG_USERREQ__MAP_IP_TO_SRCLOC: {
|
||||
Addr ip = arg[1];
|
||||
UChar* buf64 = (UChar*)arg[2];
|
||||
|
||||
VG_(memset)(buf64, 0, 64);
|
||||
UInt linenum = 0;
|
||||
Bool ok = VG_(get_filename_linenum)(
|
||||
ip, &buf64[0], 50, NULL, 0, NULL, &linenum
|
||||
);
|
||||
if (ok) {
|
||||
/* Find the terminating zero in the first 50 bytes. */
|
||||
UInt i;
|
||||
for (i = 0; i < 50; i++) {
|
||||
if (buf64[i] == 0)
|
||||
break;
|
||||
}
|
||||
/* We must find a zero somewhere in 0 .. 49. Else
|
||||
VG_(get_filename_linenum) is not properly zero
|
||||
terminating. */
|
||||
vg_assert(i < 50);
|
||||
VG_(sprintf)(&buf64[i], ":%u", linenum);
|
||||
} else {
|
||||
buf64[0] = 0;
|
||||
}
|
||||
|
||||
SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
break;
|
||||
}
|
||||
|
||||
case VG_USERREQ__MALLOCLIKE_BLOCK:
|
||||
case VG_USERREQ__FREELIKE_BLOCK:
|
||||
// Ignore them if the addr is NULL; otherwise pass onto the tool.
|
||||
|
||||
@ -4159,7 +4159,10 @@ typedef
|
||||
VG_USERREQ__STACK_CHANGE = 0x1503,
|
||||
|
||||
/* Wine support */
|
||||
VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601
|
||||
VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,
|
||||
|
||||
/* Querying of debug info. */
|
||||
VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701
|
||||
} Vg_ClientRequest;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
@ -4524,6 +4527,17 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...)
|
||||
fd, ptr, total_size, delta, 0); \
|
||||
}
|
||||
|
||||
/* Map a code address to a source file name and line number. buf64
|
||||
must point to a 64-byte buffer in the caller's address space. The
|
||||
result will be dumped in there and is guaranteed to be zero
|
||||
terminated. If no info is found, the first byte is set to zero. */
|
||||
#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \
|
||||
{unsigned int _qzz_res; \
|
||||
VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
|
||||
VG_USERREQ__MAP_IP_TO_SRCLOC, \
|
||||
addr, buf64, 0, 0, 0); \
|
||||
}
|
||||
|
||||
|
||||
#undef PLAT_x86_linux
|
||||
#undef PLAT_amd64_linux
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user