Using STL containers with GDB

Nick Roberts nickrob@snap.net.nz
Wed Apr 23 10:12:00 GMT 2008


 > >> The Python branch appears to work for executables compiled with Gcc  
 > >> only.  I'm
 > >> curious to know if this approach will work for executables built  
 > >> using other
 > >> compilers?
 > >
 > > Vincent's implementation has the layout of the GNU STL implementation
 > > hardcoded into it - so even less portable than the Python
 > > implementation, which uses the field names.
 > 
 > You are right, this patch is very hardcoded. I assume that fields of  
 > STL containers are always in the same order. I ask GDB the size of  
 > "void *", and I compute fields offsets using this information to read  
 > things I need. If you use another compiler, but with GNU STL headers,  
 > this patch *should* continue to work...

Thar's what I wonder: would your approach, implemented as a Python script,
give the best of both worlds?

-- 
Nick                                           http://www.inet.net.nz/~nickrob



More information about the Gdb-patches mailing list