User talk:Mathieu: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
m (regex)
m (tweaks)
Line 1: Line 1:
== Mac OSX ==
Some tricks I always forgot on MacOSX:
Some tricks I always forgot on MacOSX:


ldd ->
ldd -> otools -L
otools -L


strace/ltrace ->
strace/ltrace -> ktrace / kdump
ktrace / kdump
 
 
== Valgrind ==




Line 19: Line 23:
   
   
   assert( !VALGRIND_CHECK_READABLE( &variable, sizeof( variable ) ) );
   assert( !VALGRIND_CHECK_READABLE( &variable, sizeof( variable ) ) );
== GDB ==




Line 24: Line 32:
Steps:
Steps:


nm --defined-only -C vtkEnSight6Reader.o | grep '~'
  nm --defined-only -C vtkEnSight6Reader.o | grep '~'
 
copy the hexadecimal for those symbol then do
copy the hexadecimal for those symbol then do


nm --defined-only vtkEnSight6Reader.o | grep 'my_symbol'
  nm --defined-only vtkEnSight6Reader.o | grep 'my_symbol'


then you just need to add a breakpoint on that particular symbol, repeat if more than one destructor.
then you just need to add a breakpoint on that particular symbol, repeat if more than one destructor.
== CMake ==





Revision as of 19:01, 2 November 2004

Mac OSX

Some tricks I always forgot on MacOSX:

ldd -> otools -L

strace/ltrace -> ktrace / kdump


Valgrind

some valgrind 'feature' to gdb an unitialized var you need to use valgrind macro:

From [How to output address of the unitialized value? ]

Your best bet in that case is to inspect the code at the failing location and see if there is an obvious cause, and if not then to try inserting some assertions using the valgrind macros to try and work out what is uninitialised - assertions like this will do it:

  assert( !VALGRIND_CHECK_READABLE( &variable, sizeof( variable ) ) );


GDB

Yet another trick for debugging the destructor of a class: Steps:

 nm --defined-only -C vtkEnSight6Reader.o | grep '~'

copy the hexadecimal for those symbol then do

 nm --defined-only vtkEnSight6Reader.o | grep 'my_symbol'

then you just need to add a breakpoint on that particular symbol, repeat if more than one destructor.


CMake

Another trick when writting regex in CMake, look at:

http://www.aivosto.com/vbtips/regex.html

It's fairly well describe