This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

MACROS in gdb ???

Title: MACROS in gdb ???

Hello ,
I am not sure this is the right forum for a question on gdb.I am a Newbie as far as gdb is concerned.
But I have been struggling with this for quite some time and would sincerely appreciate any help.

I am trying to use gdb for a C program which makes heavy
use of C macros.

The function ldpCreateIncarn() is called with parameter u2IncarnId set to 0.

UINT1 ldpCreateIncarn (UINT2 u2IncarnId)
   UINT1 u1HoldPrio;

   if ( LDP_INCARN_STATUS(u2IncarnId) == ACTIVE ) 
       return LDP_FAILURE;

   gblTmrMemChkId = 1;
   gblSNMPMemChkId = 1;

After call to LDP_INCARN_STATUS(u2IncarnId) the value of
u2IncarnId MYSTERIOUSLY changes to 1.LDP_INCARN_STATUS is a macro defined as follows

#define LDP_INCARN_STATUS(x) (gLdpInfo.LdpIncarn[(x)].IncarnRowStatus) only reads the status from a global data-stucture and checks to see if it is ACTIVE. It does not change the value of "x" in any way.

But after processing this macro the value of u2IncarnId changes unexplicably ????

Also in this function I have some other Macros like

which are defined as
#define INIT_LBL_MGR_INFO(x) gLdpInfo.LdpIncarn[(x)].LdpLblMgrInfo.u4NumGrpsActive = LDP_ZERO;

At the time of entering such macros u2IncarnId is set to 0 but after processing the macro its value cahnges to 168 !!

(gdb) p u2IncarnId
$19 = 0
(gdb) n
(gdb) p u2IncarnId
$20 = 168

If I am missing something obvious please forgive me. I have spent the whole day trying to figure out where
I am going wrong.
Thanks in Advance,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]