|
From: Julian S. <js...@ac...> - 2006-09-11 12:46:20
|
Josef
I could reproduce this on amd64 but not on x86. So I added the
following assertion (which seems like a good idea to add permanently)
Index: callgrind/global.h
===================================================================
--- callgrind/global.h (revision 6045)
+++ callgrind/global.h (working copy)
@@ -688,7 +688,8 @@
static __inline__ Addr bb_addr(BB* bb)
{ return bb->offset + bb->obj->offset; }
static __inline__ Addr bb_jmpaddr(BB* bb)
- { return bb->instr[bb->instr_count-1].instr_offset + bb->offset +
bb->obj->offset; }
+ { tl_assert(bb->instr_count > 0);
+ return bb->instr[bb->instr_count-1].instr_offset + bb->offset +
bb->obj->offset; }
/* from fn.c */
void CLG_(init_fn_array)(fn_array*);
and now I can reproduce it on x86 too. It's not amd64 specific,
maybe just bad luck that this example did not cause &bb->instr[0]
and &bb->instr[-1] to be in different pages on x86.
Anyway .. can you have a look at it?
Test program is:
#include <unistd.h>
int main() {
while(1)
sleep(1);
return 0;
}
This is on SuSE 10.0 (x86).
Run test program with callgrind, then in a new window do:
$prefix/bin/callgrind_control -i off
$prefix/bin/callgrind_control -i on
$prefix/bin/callgrind_control -d
and it crashes immediately.
J
On Monday 11 September 2006 11:09, Christoph Bartoschek wrote:
> Am Montag, 11. September 2006 11:58 schrieb Julian Seward:
> > > b->instr[bb->instr_count-1] seems to be invalid because
> > > bb->instr_count is 0 and bb->instr_count-1 is out of range.
> >
> > That's interesting. I wonder if this happens when callgrind handles a
> > block with zero instructions in, which can happen if the instruction
> > decoder finds an unknown instruction. Christoph, does your program
> > have anything like that (eg, it catches SIGILL and handles it, and/or
> > you get messages about unknown instructions) ?
>
> Here is the whole programm:
>
> extern "C" {
> #include <unistd.h>
> }
>
>
> int main() {
> while(true)
> sleep(1);
> }
>
> Christoph
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|