On Thu, 2015-04-16 at 13:24 +0100, "João M. S. Silva" wrote:
> > I defined a gdb-macro for this:
> >
> > define get_vbits
> >    printf "# mon get_vbits 0x%lx 0x%lx\n" , &$arg0 , sizeof($arg0)
> >    eval "mon get_vbits 0x%lx 0x%lx" , &$arg0 , sizeof($arg0)
> > end
> >
> > Then I can run:
> > (gdb) get_vbits i_Cond
> > # mon get_vbits 0xffefff8bf 0x1
> > 00
> > (gdb)
> 
> Thanks for the hints. The sizeof() only works for variables, not 
> pointers, right?
Yes, it works for pointer. sizeof of a pointer returns the size of
the pointer :). So, 4 or 8 bytes, depending on the arch.
If the pointer is to a fixed size known struct, then you should
be able to use (I did not try).
     get_vbits *pointer
Finally, effectively, memcheck knows where a ptr points
(if the ptr is valid).
So, it should be possible to write a gdb command (probably difficult to
do, the gdb macro language is not very powerful) or a python extension
to do a more intelligent get_vbits which would use
  the type info known by gdb
 and/or
  monitor v.info location <address>
to have an idea about the size of the block.
and then do the correct monitor get_vbits command.
Anybody volunteering ?
We could add a file with 'various valgrind related gdb python extension'
as part of the Valgrind distribution.

> > I think there was also some option to switch valgrind so that the
> > definedness of registers can be checked: --vgdb-shadow-registers=yes
Yes, when giving this option, you can examine the definedness of a
register by printing its shadow 1 register.
For example, 
   p $eaxs1
shows the definedness of the eax register.

See
http://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.gdbserver-shadowregisters
and
http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-commands

Philippe



------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to