|
From: Josef W. <Jos...@gm...> - 2003-12-18 18:17:30
|
On Thursday 18 December 2003 02:06, Jeremy Fitzhardinge wrote:
> Eh, are you saying that the --trace-codegen=10001 output only starts
> after 0x81000D10? I can't see any way in which can not print for early
I found the culprit. Tracegen output started at BB 1, not at BB 0. Patch:
==================================================
--- vg_translate.c 18 Dec 2003 09:06:08 -0000 1.64
+++ vg_translate.c 18 Dec 2003 17:29:59 -0000
@@ -2386,7 +2386,7 @@ void VG_(translate) ( /*IN*/ ThreadId t
notrace_until_limit to be the number of translations to be made
before --trace-codegen= style printing takes effect. */
notrace_until_done
- = VG_(overall_in_count) > notrace_until_limit;
+ = VG_(overall_in_count) >= notrace_until_limit;
seg = VG_(find_segment)(orig_addr);
====================================================
I attached the output of "valgrind --skin=calltree --trace-codegen=10101 ls".
Using the debugger, I found out the place of the SEGFAULT at 0xb874d054,
in the translation of the first basic block. Disassembled with GDB:
...
Dump of assembler code from 0xb874d040 to 0xb874d060:
0xb874d040: mov $0x81000c17,%esi
0xb874d045: mov %edx,%edi
0xb874d047: mov %esi,%fs:(%edx)
0xb874d04a: mov $0xb018eb0c,%eax
0xb874d04f: mov $0x1,%ebx
0xb874d054: mov %ebx,%fs:(%eax)
0xb874d057: mov $0x68,%eax
0xb874d05c: mov %edi,%edx
0xb874d05e: call *0x30(%ebp)
...
Address 0xb874d054 corresponds to Offset 72 in the translated version (from
the attachment):
14: MOVL $0x1, %ebx [ab---D]
67: BB 01 00 00 00
movl $0x1, %ebx
15: STL %ebx, (%eax) [-----D]
72: 64 89 18
movl %ebx, (%eax)
Here, value 1 is a flag I write into a global variable of my skin/tool.
Obviously, this goes wrong as the client has no right to write into valgrind's
space (?). The flag is to be used in a helper called by the translation of the
next basic block.
Where should I allocate space for this flag?
Or better: How to get rid of the permission check, i.e. the "%fs:" segment?
Josef
|