On Fri, 2012-04-27 at 11:49 +0200, Matthias Schwarzott wrote:
> Hi there!
> 
> Comparing the output from gdb attached to valgrind gdbserver and the
> core file valgrind creates, the thread order is inverted.
> As I have more minor issues with gdb and valgrind core files, I do not
> known if this is always the case.
I do not think that there is a consistent order (inverted or not)
between the list of gdbserver threads reported to gdb
and the list of threads in the VG thread array.
The valgrind gdbserver maintains a linked list of threads
derived from new threads appearing in the array or old threads
that disappeared.
I believe (not checked) that if you have:
   create thread a
   create thread b
   create thread c
   delete thread b
   create thread d
that the VG array will contain a d b
while the gdbserver linked list will contain d b a.

If the above is correct, then the changes below will not guarantee
the order is the same.
Also, not too sure what gdb does with the list of threads it receives
from the gdbserver (maybe gdb sorts them ?).

Just to understand, why do you need to make the link between
the V core thread list and the V gdbserver thread list ?
Is it because you obtain a core dump, that you then try to
understand with V gdbserver in another run ?


> 
> For exactly this problem I have two possible solutions:
> A. Change the loop over all threads to be reversed:
> 
> 
> - for(i = 1; i < VG_N_THREADS; i++) {
> 
> + for(i = VG_N_THREADS - 1; i >= 1 ; i--) {
> 
> 
> B. Change the function add_note (or related notes processing code), to
> output the notes in the order add_note is called, and not backward.
> 
> I wonder which approach is better, but I tend to approach B, as then
> the code creates the notes in the order they appear in the final core
> file.
> 
> Regards
> Matthias
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ Valgrind-users mailing list 
> Valgrind-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/valgrind-users



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to