bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MACROS in gdb ???


From: Aditya Chugh
Subject: MACROS in gdb ???
Date: Tue, 20 Mar 2001 03:25:15 +0500

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;

   LDP_ASSERT(u2IncarnId == LDP_CUR_INCARN);
   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)

...it 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

INIT_LBL_MGR_INFO(u2IncarnId)
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,
Aditya


reply via email to

[Prev in Thread] Current Thread [Next in Thread]