Re: evaluating #defines in gdb?

From: Pink Floyd (floyd@south.mit.edu)
Date: 11/03/95


   > 	Well, it's not a total loss if you're using gcc and gdb;
   > apparently gcc supports a -ggdb# where # specifies the level of
   > debugging information you want added to the generated binaries.  The
   > highest level, 3, _supposedly_ groks macro definitions, too.  But,
   > I've never tried this, so I don't know how well this works, if it does
   > at all.  YMMV!  =8-)

   Ok, just tried this with gcc 2.7.0 and gdb 4.14:
   Mark's suggestion of -ggdb3 didn't recognize any symbol for a macro 
   definition I used.
   However, an inline-function version of the macro worked fine, use the 
   'call' command in gdb to call the function.  It will be inlined for most 
   uses, so there's no overhead.  Also, gives you type safety, almost
   always a good thing.

   An example (with the variables possibly screwed up):
   inline int GET_STR(const struct char_data *ch)
   {
	   return ch->aff_abils.str;
   }


I thought 'inline' was a C++ keyword?  And I thought it was used in the 
actual function call, not the definition.  Is this some feature of gcc of
which I was unaware?



This archive was generated by hypermail 2b30 : 12/07/00 PST