|
From: Joe S. <st...@sa...> - 2003-03-20 16:07:43
|
(a) Has anyone had experience debugging SystemC programs with valgrind? Were there any unexpected problems? (b) Can anyone suggest what I should do next with the following problem? I have a SystemC program which maintains a number of queues, implemented as C++ list<packet *>. gdb reveals that after the simulation has been running for a considerable time, I create and initialise a packet and put it on the back of one queue, but a packet with the same pointer is already at the front of a quite different queue and has its contents overwritten. (All queues and packets are in storage around 0x8,000,000.) This looks like a classic case of premature deletion, so I try to find it with valgrind. But valgrind produces an "invalid read" error a little bit earlier in the simulation, and gdb shows all the packets in the queue about to be clobbered have now been moved to invalid addresses around 0x43,000,000. (Valgrind guesses that this address is "on thread 1's stack", but I'm not sure that's reliable.) Running without valgrind shows, according to gdb at the relevant moment, no sign of this relocation. So I reckon that if the packets have turned up in the new place, something (presumably with access rights) must have put them there. So I try again with the offending address made invalid by a VALGRIND_MAKE_NOACCESS call, hoping to catch whatever it is that wrote them in the first place. But the program fails in the same place as before (though this time the error is because I've declared the address invalid, not because valgrind thought it was invalid anyway). The packets are all there at the new place, with their proper contents; but whatever it is that wrote them there snuck in under my prohibition. Sorry to go on at length, but I'm a bit stuck. I'd be grateful for any suggestions . . . joe stoy |