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.
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__)
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