From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16831 invoked by alias); 16 Sep 2003 18:45:21 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 16823 invoked from network); 16 Sep 2003 18:45:19 -0000 Received: from unknown (HELO web8206.mail.in.yahoo.com) (203.199.70.75) by sources.redhat.com with SMTP; 16 Sep 2003 18:45:19 -0000 Message-ID: <20030916184516.23765.qmail@web8206.mail.in.yahoo.com> Received: from [203.193.132.44] by web8206.mail.in.yahoo.com via HTTP; Tue, 16 Sep 2003 19:45:16 BST Date: Tue, 16 Sep 2003 18:45:00 -0000 From: =?iso-8859-1?q?puneet=20girdhar?= Subject: Regarding gcc debugging To: gcc-help@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2003-09/txt/msg00196.txt.bz2 Hi, I am trying to debug a C++ program with gdb on Linux AS 2.1. when the program terminates,the destructor is called and this destructor in turn calls the un-initializer routine.After the Un-inilization routine is over it does not give core dump.But then it goes in main and gives core dump. ***************source code starts*********** void SmAgentExample::Sm_UnInit( ) { int iResult; printf("Value of pSmApiHandle inside Sm_UnInit is %x\n",pSmApiHandle); if ( NULL != pSmApiHandle ) { Sm_Logout(); // // UnInitialize the Agent API // // Return values: // SM_AGENTAPI_SUCCESS // SM_AGENTAPI_FAILURE // SM_AGENTAPI_NOCONNECTION iResult = Sm_AgentApi_UnInit( &pSmApiHandle ); if (SM_AGENTAPI_SUCCESS==iResult) printf ( "Agent Released\n" ); else if (SM_AGENTAPI_FAILURE==iResult) printf ( "UnInitialzation Failed\n" ); else if (SM_AGENTAPI_NOCONNECTION==iResult) printf ( "Timeout for server response!\n" ); } printf("I am here\n"); login = 0; } SmAgentExample::~SmAgentExample() { pSmApiHandle = NULL; printf("Inside destructor\n"); Sm_AgentApi_FreeAttributes(iNumAttributes, pAttributes); printf("Before Sm_UnInit function\n"); Sm_UnInit( ); } int main() { ..... ..... while{ switch(input) case 'q' : break; ....... } a.Sm_UnInit( ); printf ( "Done, thank you for Testing the API.\n" ); return 0; } **************source code ends*********** -------------output of gdb--------- FTP> q Breakpoint 1, SmAgentExample::Sm_UnInit() (this=0x1) at smagentexample.cpp:220 220 { (gdb) s 0x0804a601 in main () (gdb) s Single stepping until exit from function main, which has no line number information. Value of pSmApiHandle inside Sm_UnInit is 8052728 Agent Released I am here Done, thank you for Testing the API. Inside destructor Before Sm_UnInit function Breakpoint 1, SmAgentExample::Sm_UnInit() (this=0xbffe5a50) at smagentexample.cpp:220 220 { (gdb) s 0x0804a601 in main () (gdb) s Single stepping until exit from function main, which has no line number information. Value of pSmApiHandle inside Sm_UnInit is 0 I am here Breakpoint 3, main () at smagentexample.cpp:778 778 } (gdb) s 0x4021a727 in __libc_start_main () from /lib/libc.so.6 (gdb) s Single stepping until exit from function __libc_start_main, which has no line number information. Program received signal SIGSEGV, Segmentation fault. 0x403c7112 in ?? (). When i gave bt command it gave: (gdb) bt #0 0x403c7112 in ?? () #1 0x4021a730 in __libc_start_main () from /lib/libc.so.6 -------------output of gdb--------------------- Can anybody give any ptrs on this that why it is dumping core. Thanks in advance. Regards Puneet ________________________________________________________________________ Yahoo! India Matrimony: Find your partner online. Go to http://yahoo.shaadi.com