By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Please help me for segmentation fault

P: 56
Hi,

I am facing a segmentation fault in my program.
I am using C++, SunOS-5.6. I am debugging the application using dbx.
Here I am pasting a portion.


Ccy:KRW
Gbo Ccy:
t@1 (l@1) signal SEGV (no mapping at the fault address) in dmgDocRecuresList at 0xec4af5d0
dmgDocRecuresList+0x644: ld [%g3 + %g2], %g3
(dbx) where
=>[1] dmgDocRecuresList(0xefff92bc
, 0xee78d0ec, 0xefff930c, 0x0, 0x2, 0xefff9304), at 0xec4af5d0
[2] dmgDocRecuresList(0xefff92bc, 0x18, 0xefff930c, 0x58d430, 0x2, 0xefff9304), at 0xec4af3bc
[3] compareTradeChanges(0xec6ef4cd, 0xec6f2174, 0xec7a9620, 0xee776964, 0x0, 0x0), at 0xec6cee6c
[4] RejectAmendFieldCheck(0xee6d1968, 0xefff97c8, 0xee776964, 0xee7805c4, 0x8, 0x0), at 0xec6cca20
[5] dmgDocumentDo(0xefff95c4, 0x31660, 0x0, 0x1, 0x2, 0x345e28), at 0xec6cdcb8
[6] GenerateDocument(0x0, 0x31630, 0x3, 0xee78d0ec, 0xee6ae294, 0x31660), at 0xedda2d04
[7] ProcessAuditList(0x31680, 0x31630, 0x2, 0x95e82, 0x2008, 0x316ac), at 0xedda2a24
[8] main(0x31630, 0x0, 0x1, 0xefffa0dc, 0xee78d0ec, 0xee6ae294), at 0x11d04
(dbx) lwps
*>l@1 signal SIGSEGV in dmgDocRecuresList()
l@2 running in _signotifywait()
l@3 running in _poll()
l@4 running in _poll()
l@5 running in _door_return()
(dbx) lwp l@1
t@1 (l@1) stopped in dmgDocRecuresList at 0xec4af5d0
dmgDocRecuresList+0x644: ld [%g3 + %g2], %g3
(dbx) where
=>[1] dmgDocRecuresList(0xefff92bc, 0xee78d0ec, 0xefff930c, 0x0, 0x2, 0xefff9304), at 0xec4af5d0
[2] dmgDocRecuresList(0xefff92bc, 0x18, 0xefff930c, 0x58d430, 0x2, 0xefff9304), at 0xec4af3bc
[3] compareTradeChanges(0xec6ef4cd, 0xec6f2174, 0xec7a9620, 0xee776964, 0x0, 0x0), at 0xec6cee6c
[4] RejectAmendFieldCheck(0xee6d1968, 0xefff97c8, 0xee776964, 0xee7805c4, 0x8, 0x0), at 0xec6cca20
[5] dmgDocumentDo(0xefff95c4, 0x31660, 0x0, 0x1, 0x2, 0x345e28), at 0xec6cdcb8
[6] GenerateDocument(0x0, 0x31630, 0x3, 0xee78d0ec, 0xee6ae294, 0x31660), at 0xedda2d04
[7] ProcessAuditList(0x31680, 0x31630, 0x2, 0x95e82, 0x2008, 0x316ac), at 0xedda2a24
[8] main(0x31630, 0x0, 0x1, 0xefffa0dc, 0xee78d0ec, 0xee6ae294), at 0x11d04
(dbx) step



Here I am pasting the declaration of the function

int dmgDocRecuresList( sTRADETYPE pTradeType,
sENTITY* pCurrentEnt,
char* pCurrentData,
char* pOldData,
int* pCount,
int* pCount2,
sDATANODELIST* pDataNodeList,
sDATANODELIST* pDataNodeList2,
DMG_DOC_ACCEPT_REJECT* pRetValue,
cDOC_AMEND_LIST* pDocAmendList = NULL );

is a recursive function. That is this function calls itself according to some conditions.

I could not find what to see and where to see. Please help me.
Jun 13 '07 #1
Share this Question
Share on Google+
1 Reply


P: 94
Hi, try allocating some memory in your main program
For instance
Expand|Select|Wrap|Line Numbers
  1. int *pCount = new int;
  2.  
but do that for all the pointers you are about to use
Don't forget to say
Expand|Select|Wrap|Line Numbers
  1.  delete pCount; 
deallocating all of the memory you allocated with the 'new' operator to prevent memory leakages
Jun 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.