This commit is contained in:
parent
e3211ae1ad
commit
62981295de
@ -1,227 +1,231 @@
|
||||
--- coregrind/m_debuginfo/debuginfo.c
|
||||
+++ coregrind/m_debuginfo/debuginfo.c
|
||||
@@ -33,7 +33,7 @@
|
||||
This module was also extensively hacked on by Jeremy Fitzhardinge
|
||||
and Tom Hughes.
|
||||
*/
|
||||
-
|
||||
+#include <stdio.h>
|
||||
#include "pub_core_basics.h"
|
||||
#include "pub_core_threadstate.h"
|
||||
#include "pub_core_debuginfo.h" /* self */
|
||||
@@ -376,6 +376,7 @@
|
||||
}
|
||||
}
|
||||
not_found:
|
||||
+
|
||||
*psi = NULL;
|
||||
}
|
||||
|
||||
@@ -449,6 +450,120 @@
|
||||
return True;
|
||||
}
|
||||
|
||||
+typedef struct {
|
||||
+ char *name;
|
||||
+ Addr start, end;
|
||||
+} JitEntry;
|
||||
+
|
||||
+static JitEntry *jit_entries;
|
||||
+static int jit_entries_size;
|
||||
+static int jit_entry_count;
|
||||
+
|
||||
+#define START_SIZE 128
|
||||
+#define INCREMENT 64
|
||||
+
|
||||
+void VG_(register_jited_code) ( Char *name, Addr start, SizeT len)
|
||||
+{
|
||||
+ int l, u, mid, slot, j;
|
||||
+ JitEntry *e = NULL;
|
||||
+
|
||||
+ if (jit_entry_count + 1 >= jit_entries_size){
|
||||
+ if (jit_entries == NULL){
|
||||
+ jit_entries = VG_(arena_calloc)(VG_AR_SYMTAB, START_SIZE, sizeof(JitEntry));
|
||||
+ jit_entries_size = START_SIZE;
|
||||
+ } else {
|
||||
+ jit_entries = VG_(arena_realloc)(VG_AR_SYMTAB, jit_entries, (jit_entries_size + INCREMENT) * sizeof(JitEntry));
|
||||
+ jit_entries_size += INCREMENT;
|
||||
+ }
|
||||
+ }
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u){
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+ if (e->start < start){
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > start){
|
||||
+ u = mid;
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+ if (e == NULL){
|
||||
+ if (jit_entry_count != 0){
|
||||
+ // this would be an error;
|
||||
+ }
|
||||
+ slot = 0;
|
||||
+ } else if (e->start < start)
|
||||
+ slot = mid + 1;
|
||||
+ else
|
||||
+ slot = mid;
|
||||
+
|
||||
+ if (e != NULL){
|
||||
+ for (j = jit_entry_count; j > mid+1; j--)
|
||||
+ jit_entries [j] = jit_entries [j-1];
|
||||
+ }
|
||||
+
|
||||
+ jit_entries [slot].name = VG_(strdup)(name);
|
||||
+ jit_entries [slot].start = start;
|
||||
+ jit_entries [slot].end = start + len;
|
||||
+ jit_entry_count++;
|
||||
+}
|
||||
+
|
||||
+void VG_(unregister_jited_code) ( Addr start )
|
||||
+{
|
||||
+ int l, u, mid;
|
||||
+ JitEntry *e = NULL;
|
||||
+
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u){
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+
|
||||
+ if (e->start < start){
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > start){
|
||||
+ u = mid;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (e != NULL && start == e->start){
|
||||
+ int j;
|
||||
+
|
||||
+ VG_(free) (e->name);
|
||||
+ for (j = mid + 1; j < jit_entry_count; j++)
|
||||
+ jit_entries [j-1] = jit_entries [j];
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static Bool
|
||||
+jit_lookup ( Addr pc, Char* buf, Int nbuf )
|
||||
+{
|
||||
+ int l, u, mid;
|
||||
+ JitEntry *e = NULL;
|
||||
+
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u){
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+
|
||||
+ if (e->end < pc){
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > pc){
|
||||
+ u = mid;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (e != NULL && pc >= e->start && pc < e->end){
|
||||
+ VG_(strncpy_safely) (buf, e->name, nbuf);
|
||||
+ return True;
|
||||
+ }
|
||||
+ return False;
|
||||
+}
|
||||
+
|
||||
/* ppc64-linux only: find the TOC pointer (R2 value) that should be in
|
||||
force at the entry point address of the function containing
|
||||
guest_code_addr. Returns 0 if not known. */
|
||||
@@ -708,6 +823,10 @@
|
||||
buf_dirname, BUF_LEN, &know_dirinfo,
|
||||
&lineno
|
||||
);
|
||||
+ if (!know_fnname){
|
||||
+ know_fnname = jit_lookup (eip, buf_fn, BUF_LEN);
|
||||
+ }
|
||||
+
|
||||
if (VG_(clo_xml)) {
|
||||
|
||||
Bool human_readable = True;
|
||||
--- coregrind/m_scheduler/scheduler.c 2007-01-08 02:43:14.000000000 -0500
|
||||
+++ coregrind/m_scheduler/scheduler.c 2007-07-04 02:42:04.000000000 -0400
|
||||
@@ -81,6 +81,7 @@
|
||||
#include "pub_core_tooliface.h"
|
||||
#include "pub_core_translate.h" // For VG_(translate)()
|
||||
#include "pub_core_transtab.h"
|
||||
+#include "pub_core_debuginfo.h"
|
||||
#include "vki_unistd.h"
|
||||
#include "priv_sema.h"
|
||||
|
||||
@@ -1256,6 +1257,16 @@
|
||||
SET_CLREQ_RETVAL( tid, VG_(get_n_errs_found)() );
|
||||
break;
|
||||
|
||||
+ case VG_USERREQ__JIT_REGISTER_MAP:
|
||||
+ VG_(register_jited_code) ((char *) arg [1], arg[2], arg[3]);
|
||||
+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
+ break;
|
||||
+
|
||||
+ case VG_USERREQ__JIT_UNREGISTER_MAP:
|
||||
+ VG_(unregister_jited_code) (arg[1]);
|
||||
+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
if (os_client_request(tid, arg)) {
|
||||
// do nothing, os_client_request() handled it
|
||||
--- coregrind/pub_core_debuginfo.h 2007-01-08 02:43:15.000000000 -0500
|
||||
+++ coregrind/pub_core_debuginfo.h 2007-07-04 02:39:22.000000000 -0400
|
||||
@@ -54,6 +54,9 @@
|
||||
extern Bool VG_(get_fnname_nodemangle)( Addr a,
|
||||
Char* fnname, Int n_fnname );
|
||||
|
||||
+extern void VG_(register_jited_code) ( Char *name, Addr start, SizeT len );
|
||||
+extern void VG_(unregister_jited_code) ( Addr start );
|
||||
+
|
||||
/* Use DWARF2/3 CFA information to do one step of stack unwinding. */
|
||||
extern Bool VG_(use_CF_info) ( /*MOD*/Addr* ipP,
|
||||
/*MOD*/Addr* spP,
|
||||
--- include/valgrind.h 2007-01-08 02:43:09.000000000 -0500
|
||||
+++ include/valgrind.h 2007-07-04 02:41:38.000000000 -0400
|
||||
@@ -2296,7 +2296,12 @@
|
||||
Index: include/valgrind.h
|
||||
===================================================================
|
||||
--- include/valgrind.h (revision 7276)
|
||||
+++ include/valgrind.h (working copy)
|
||||
@@ -3625,7 +3625,11 @@
|
||||
/* Stack support. */
|
||||
VG_USERREQ__STACK_REGISTER = 0x1501,
|
||||
VG_USERREQ__STACK_DEREGISTER = 0x1502,
|
||||
- VG_USERREQ__STACK_CHANGE = 0x1503
|
||||
+ VG_USERREQ__STACK_CHANGE = 0x1503,
|
||||
+
|
||||
+ /* JIT suppor */
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP = 0x1601,
|
||||
+ VG_USERREQ__JIT_UNREGISTER_MAP = 0x1602
|
||||
+
|
||||
+ /* JIT support */
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP = 0x1601,
|
||||
+ VG_USERREQ__JIT_UNREGISTER_MAP = 0x1602
|
||||
} Vg_ClientRequest;
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
@@ -2530,7 +2535,20 @@
|
||||
@@ -3904,7 +3908,21 @@
|
||||
id, start, end, 0, 0); \
|
||||
}
|
||||
|
||||
+#define VALGRIND_JIT_REGISTER_MAP(name, start, end) \
|
||||
+#define VALGRIND_JIT_REGISTER_MAP(name, start, end) \
|
||||
+ {unsigned int _qzz_res; \
|
||||
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP, \
|
||||
+ name, start, end, 0, 0); \
|
||||
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP, \
|
||||
+ name, start, end, 0, 0); \
|
||||
+ }
|
||||
|
||||
+#define VALGRIND_JIT_UNREGISTER_MAP(name, start) \
|
||||
+#define VALGRIND_JIT_UNREGISTER_MAP(name, start) \
|
||||
+ {unsigned int _qzz_res; \
|
||||
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP, \
|
||||
+ start, 0, 0, 0, 0); \
|
||||
+ VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
|
||||
+ VG_USERREQ__JIT_REGISTER_MAP, \
|
||||
+ start, 0, 0, 0, 0); \
|
||||
+ }
|
||||
+
|
||||
#undef ARCH_x86
|
||||
#undef ARCH_amd64
|
||||
#undef ARCH_ppc32
|
||||
+
|
||||
+
|
||||
#undef PLAT_x86_linux
|
||||
#undef PLAT_amd64_linux
|
||||
#undef PLAT_ppc32_linux
|
||||
Index: coregrind/m_debuginfo/debuginfo.c
|
||||
===================================================================
|
||||
--- coregrind/m_debuginfo/debuginfo.c (revision 7276)
|
||||
+++ coregrind/m_debuginfo/debuginfo.c (working copy)
|
||||
@@ -576,6 +576,132 @@
|
||||
return True;
|
||||
}
|
||||
|
||||
+
|
||||
+/* Storing and retrieving information caused by JITted code. TODO:
|
||||
+ move somewhere more suitable. */
|
||||
+
|
||||
+typedef
|
||||
+ struct {
|
||||
+ Char *name;
|
||||
+ Addr start, end;
|
||||
+ }
|
||||
+ JitEntry;
|
||||
+
|
||||
+static JitEntry *jit_entries;
|
||||
+static Int jit_entries_size;
|
||||
+static Int jit_entry_count;
|
||||
+
|
||||
+#define JITSYMS_START_SIZE 128
|
||||
+#define JITSYMS_INCREMENT 64
|
||||
+
|
||||
+void VG_(register_jited_code) ( Char *name, Addr start, SizeT len)
|
||||
+{
|
||||
+ Int l, u, mid, slot, j;
|
||||
+ JitEntry* e = NULL;
|
||||
+
|
||||
+ if (jit_entry_count + 1 >= jit_entries_size) {
|
||||
+ if (jit_entries == NULL) {
|
||||
+ jit_entries = VG_(arena_calloc)(
|
||||
+ VG_AR_SYMTAB,
|
||||
+ JITSYMS_START_SIZE, sizeof(JitEntry)
|
||||
+ );
|
||||
+ jit_entries_size = JITSYMS_START_SIZE;
|
||||
+ } else {
|
||||
+ jit_entries = VG_(arena_realloc)(
|
||||
+ VG_AR_SYMTAB, jit_entries,
|
||||
+ (jit_entries_size + JITSYMS_INCREMENT)
|
||||
+ * sizeof(JitEntry)
|
||||
+ );
|
||||
+ jit_entries_size += JITSYMS_INCREMENT;
|
||||
+ }
|
||||
+ }
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u) {
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+ if (e->start < start) {
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > start) {
|
||||
+ u = mid;
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+ if (e == NULL) {
|
||||
+ if (jit_entry_count != 0) {
|
||||
+ /* this would be an error */
|
||||
+ }
|
||||
+ slot = 0;
|
||||
+ } else if (e->start < start)
|
||||
+ slot = mid + 1;
|
||||
+ else
|
||||
+ slot = mid;
|
||||
+
|
||||
+ if (e != NULL) {
|
||||
+ for (j = jit_entry_count; j > mid+1; j--)
|
||||
+ jit_entries [j] = jit_entries [j-1];
|
||||
+ }
|
||||
+
|
||||
+ jit_entries [slot].name = VG_(strdup)(name);
|
||||
+ jit_entries [slot].start = start;
|
||||
+ jit_entries [slot].end = start + len;
|
||||
+ jit_entry_count++;
|
||||
+}
|
||||
+
|
||||
+void VG_(unregister_jited_code) ( Addr start )
|
||||
+{
|
||||
+ Int l, u, mid;
|
||||
+ JitEntry* e = NULL;
|
||||
+
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u) {
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+
|
||||
+ if (e->start < start) {
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > start) {
|
||||
+ u = mid;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (e != NULL && start == e->start){
|
||||
+ Int j;
|
||||
+ VG_(free)(e->name);
|
||||
+ for (j = mid + 1; j < jit_entry_count; j++)
|
||||
+ jit_entries [j-1] = jit_entries [j];
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+Bool jit_lookup ( Addr pc, Char* buf, Int nbuf )
|
||||
+{
|
||||
+ Int l, u, mid;
|
||||
+ JitEntry* e = NULL;
|
||||
+
|
||||
+ l = 0;
|
||||
+ u = jit_entry_count;
|
||||
+ while (l < u) {
|
||||
+ mid = (l + u) / 2;
|
||||
+ e = &jit_entries [mid];
|
||||
+
|
||||
+ if (e->end < pc) {
|
||||
+ l = mid + 1;
|
||||
+ } else if (e->start > pc) {
|
||||
+ u = mid;
|
||||
+ } else {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (e != NULL && pc >= e->start && pc < e->end){
|
||||
+ VG_(strncpy_safely)(buf, e->name, nbuf);
|
||||
+ return True;
|
||||
+ }
|
||||
+ return False;
|
||||
+}
|
||||
+
|
||||
/* ppc64-linux only: find the TOC pointer (R2 value) that should be in
|
||||
force at the entry point address of the function containing
|
||||
guest_code_addr. Returns 0 if not known. */
|
||||
@@ -894,6 +1020,10 @@
|
||||
buf_dirname, BUF_LEN, &know_dirinfo,
|
||||
&lineno
|
||||
);
|
||||
+ if (!know_fnname){
|
||||
+ know_fnname = jit_lookup (eip, buf_fn, BUF_LEN);
|
||||
+ }
|
||||
+
|
||||
if (VG_(clo_xml)) {
|
||||
|
||||
Bool human_readable = True;
|
||||
Index: coregrind/pub_core_debuginfo.h
|
||||
===================================================================
|
||||
--- coregrind/pub_core_debuginfo.h (revision 7276)
|
||||
+++ coregrind/pub_core_debuginfo.h (working copy)
|
||||
@@ -75,6 +75,10 @@
|
||||
extern Bool VG_(get_fnname_nodemangle)( Addr a,
|
||||
Char* fnname, Int n_fnname );
|
||||
|
||||
+/* Register/deregister symbols created by JITs. */
|
||||
+extern void VG_(register_jited_code)( Char* name, Addr start, SizeT len );
|
||||
+extern void VG_(unregister_jited_code)( Addr start );
|
||||
+
|
||||
/* Use DWARF2/3 CFA information to do one step of stack unwinding. */
|
||||
extern Bool VG_(use_CF_info) ( /*MOD*/Addr* ipP,
|
||||
/*MOD*/Addr* spP,
|
||||
Index: coregrind/m_scheduler/scheduler.c
|
||||
===================================================================
|
||||
--- coregrind/m_scheduler/scheduler.c (revision 7276)
|
||||
+++ coregrind/m_scheduler/scheduler.c (working copy)
|
||||
@@ -83,6 +83,7 @@
|
||||
#include "pub_core_tooliface.h"
|
||||
#include "pub_core_translate.h" // For VG_(translate)()
|
||||
#include "pub_core_transtab.h"
|
||||
+#include "pub_core_debuginfo.h" // VG_({un}register_jited_code)
|
||||
#include "priv_sema.h"
|
||||
#include "pub_core_scheduler.h" // self
|
||||
|
||||
@@ -1367,6 +1368,16 @@
|
||||
SET_CLREQ_RETVAL( tid, VG_(get_n_errs_found)() );
|
||||
break;
|
||||
|
||||
+ case VG_USERREQ__JIT_REGISTER_MAP:
|
||||
+ VG_(register_jited_code)( (Char*)arg[1], arg[2], arg[3] );
|
||||
+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
+ break;
|
||||
+
|
||||
+ case VG_USERREQ__JIT_UNREGISTER_MAP:
|
||||
+ VG_(unregister_jited_code)( arg[1] );
|
||||
+ SET_CLREQ_RETVAL( tid, 0 ); /* return value is meaningless */
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
if (os_client_request(tid, arg)) {
|
||||
// do nothing, os_client_request() handled it
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 6 02:05:38 CET 2007 - dmueller@suse.de
|
||||
|
||||
- update jit-support patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 3 21:37:39 CET 2007 - dmueller@suse.de
|
||||
|
||||
|
@ -26,7 +26,7 @@ Group: Development/Tools/Debuggers
|
||||
Summary: Valgrind Suite of Tools for Debugging and Profiling
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Version: 3.3.0
|
||||
Release: 1
|
||||
Release: 3
|
||||
Source0: %{name}-%{version}.RC1.tar.bz2
|
||||
# svn di svn://svn.valgrind.org/valgrind/tags/VALGRIND_3_2_1 svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_2_BRANCH > 3_2_BRANCH.diff
|
||||
# svn di svn://svn.valgrind.org/vex/tags/VEX_3_2_1 svn://svn.valgrind.org/vex/branches/VEX_3_2_BRANCH > VEX_3_2_BRANCH.diff
|
||||
@ -112,8 +112,7 @@ Authors:
|
||||
%setup -q -n %{name}-%{version}.RC1
|
||||
cd VEX
|
||||
cd ..
|
||||
# does not apply anymore
|
||||
#%patch8
|
||||
%patch8
|
||||
|
||||
%build
|
||||
export CFLAGS="$RPM_OPT_FLAGS"
|
||||
@ -143,6 +142,8 @@ mv $RPM_BUILD_ROOT/usr/share/doc/valgrind $RPM_BUILD_ROOT/usr/share/doc/packages
|
||||
%_libdir/valgrind/*/*.a
|
||||
|
||||
%changelog
|
||||
* Thu Dec 06 2007 - dmueller@suse.de
|
||||
- update jit-support patch
|
||||
* Mon Dec 03 2007 - dmueller@suse.de
|
||||
- update to 3.3.0 RC1:
|
||||
- Helgrind works again
|
||||
|
Loading…
Reference in New Issue
Block a user