|
From: <sv...@va...> - 2005-11-20 19:37:57
|
Author: sewardj
Date: 2005-11-20 19:37:54 +0000 (Sun, 20 Nov 2005)
New Revision: 5223
Log:
As with ppc it's necessary to have an initial redirect for index(strchr)
on x86 glibc-2.3.5.
Modified:
trunk/coregrind/m_redir.c
trunk/coregrind/m_trampoline.S
trunk/coregrind/pub_core_trampoline.h
Modified: trunk/coregrind/m_redir.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_redir.c 2005-11-20 19:08:08 UTC (rev 5222)
+++ trunk/coregrind/m_redir.c 2005-11-20 19:37:54 UTC (rev 5223)
@@ -160,7 +160,11 @@
TRACE_REDIR(" redir %s:%s:%p->%p duplicated\n",
redir->from_lib, redir->from_sym, redir->from_addr,
redir->to_addr);
- VG_(arena_free)(VG_AR_SYMTAB, redir);
+ // jrs 20 Nov 05: causes this: m_mallocfree.c:170
+ // (mk_plain_bszB): Assertion 'bszB !=3D 0' failed.
+ // Perhaps it is an invalid free? Disable for now
+ // XXX leak?
+ //VG_(arena_free)(VG_AR_SYMTAB, redir);
}
break;
}
@@ -362,6 +366,14 @@
"soname:ld-linux.so.2", "_dl_sysinfo_int80",
(Addr)&VG_(x86_linux_REDIR_FOR__dl_sysinfo_int80)
);
+ /* If we're using memcheck, use this intercept right from the
+ start, otherwise ld.so (glibc-2.3.5) makes a lot of noise. */
+ if (0=3D=3DVG_(strcmp)("Memcheck", VG_(details).name)) {
+ add_redirect_sym_to_addr(
+ "soname:ld-linux.so.2", "index",
+ (Addr)&VG_(x86_linux_REDIR_FOR_index)
+ ); =20
+ }
=20
#elif defined(VGP_amd64_linux)
=20
Modified: trunk/coregrind/m_trampoline.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_trampoline.S 2005-11-20 19:08:08 UTC (rev 5222)
+++ trunk/coregrind/m_trampoline.S 2005-11-20 19:37:54 UTC (rev 5223)
@@ -73,7 +73,49 @@
/* We can point our sysinfo stuff here */
int $0x80
ret
-=09
+
+/* There's no particular reason that this needs to be handwritten
+ assembly, but since that's what this file contains, here's a
+ simple index implementation (written in C and compiled by gcc.)
+
+ unsigned char* REDIR_FOR_index ( const char* s, int c )=20
+ {=20
+ unsigned char ch =3D (unsigned char)((unsigned int)c);=20
+ unsigned char* p =3D (unsigned char*)s;=20
+ unsigned char* last =3D 0;=20
+ while (1) {=20
+ if (*p =3D=3D ch) last =3D p;=20
+ if (*p =3D=3D 0) return last;=20
+ p++;=20
+ }=20
+ }
+*/
+.global VG_(x86_linux_REDIR_FOR_index)
+.type VG_(x86_linux_REDIR_FOR_index), @function
+VG_(x86_linux_REDIR_FOR_index):
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ movb 12(%ebp), %al
+ movl 8(%ebp), %ecx
+ movl $0, %ebx
+.L2:
+ movb (%ecx), %dl
+ cmpb %dl, %al
+ jne .L3
+ movl %ecx, %ebx
+.L3:
+ testb %dl, %dl
+ je .L8
+ addl $1, %ecx
+ jmp .L2
+.L8:
+ movl %ebx, %eax
+ popl %ebx
+ popl %ebp
+ ret
+.size VG_(x86_linux_REDIR_FOR_index), .-VG_(x86_linux_REDIR_FOR_index)
+
.global VG_(trampoline_stuff_end)
VG_(trampoline_stuff_end):
=20
Modified: trunk/coregrind/pub_core_trampoline.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_trampoline.h 2005-11-20 19:08:08 UTC (rev 52=
22)
+++ trunk/coregrind/pub_core_trampoline.h 2005-11-20 19:37:54 UTC (rev 52=
23)
@@ -51,6 +51,7 @@
extern void VG_(x86_linux_SUBST_FOR_sigreturn);
extern void VG_(x86_linux_SUBST_FOR_rt_sigreturn);
extern void VG_(x86_linux_REDIR_FOR__dl_sysinfo_int80);
+extern Char* VG_(x86_linux_REDIR_FOR_index) ( const Char*, Int );
#endif
=20
#if defined(VGP_amd64_linux)
|