mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
As with ppc it's necessary to have an initial redirect for index(strchr)
on x86 glibc-2.3.5. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5223
This commit is contained in:
parent
0a24c03427
commit
fbf6836aec
@ -160,7 +160,11 @@ static void add_redir_to_resolved_list(CodeRedirect *redir, Bool need_discard)
|
||||
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 != 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 @@ void VG_(setup_code_redirect_table) ( void )
|
||||
"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==VG_(strcmp)("Memcheck", VG_(details).name)) {
|
||||
add_redirect_sym_to_addr(
|
||||
"soname:ld-linux.so.2", "index",
|
||||
(Addr)&VG_(x86_linux_REDIR_FOR_index)
|
||||
);
|
||||
}
|
||||
|
||||
#elif defined(VGP_amd64_linux)
|
||||
|
||||
|
||||
@ -73,7 +73,49 @@ VG_(x86_linux_REDIR_FOR__dl_sysinfo_int80):
|
||||
/* We can point our sysinfo stuff here */
|
||||
int $0x80
|
||||
ret
|
||||
|
||||
|
||||
/* 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 )
|
||||
{
|
||||
unsigned char ch = (unsigned char)((unsigned int)c);
|
||||
unsigned char* p = (unsigned char*)s;
|
||||
unsigned char* last = 0;
|
||||
while (1) {
|
||||
if (*p == ch) last = p;
|
||||
if (*p == 0) return last;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
.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):
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ extern void VG_(trampoline_stuff_end);
|
||||
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
|
||||
|
||||
#if defined(VGP_amd64_linux)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user