Thread: [Dev-C++] Segmentation Fault - Debugging
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jamiil A. <jal...@gm...> - 2007-07-21 11:33:27
|
Hello. I have a segmentation fault in my program, I know that I could trace, or = back trace in this case, to find where the the segmentation fault = occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or = tell how to do it under Dev-Cpp? Thanks everyone. |
|
From: Adam J. <aj...@i-...> - 2007-07-21 12:47:14
|
You Wrote: > I have a segmentation fault in my program This usually indicates a pointer allocation problem. Check your pointers = in your program. Make sure they are allocated and initialized correctly = before using them. Without out knowing more about the code or what you are = doing, this is the only advice I can give at this point. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Saturday, July 21, 2007 10:37 AM To: Dev Cpp MailingLinst Subject: [Dev-C++] Segmentation Fault - Debugging Hello. I have a segmentation fault in my program, I know that I could trace, or back trace in this case, to find where the the segmentation fault = occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or = tell how to do it under Dev-Cpp? =A0 Thanks everyone. |
|
From: Jamiil A. <jal...@gm...> - 2007-07-21 18:06:02
|
Well, I would like to give you more information, but my problem is that I don't know how to utilize Dev-Cpp's debugger to locate the problem. If you know a trick to catch the problemed code, please let me know. Thanks in advance. ----- Original Message ----- From: "Adam Jones" <aj...@i-...> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" <dev...@li...> Sent: Saturday, July 21, 2007 5:47 AM Subject: RE: [Dev-C++] Segmentation Fault - Debugging You Wrote: > I have a segmentation fault in my program This usually indicates a pointer allocation problem. Check your pointers in your program. Make sure they are allocated and initialized correctly before using them. Without out knowing more about the code or what you are doing, this is the only advice I can give at this point. -Adam Jones From: dev...@li... [mailto:dev...@li...] On Behalf Of Jamiil Abduqadir Sent: Saturday, July 21, 2007 10:37 AM To: Dev Cpp MailingLinst Subject: [Dev-C++] Segmentation Fault - Debugging Hello. I have a segmentation fault in my program, I know that I could trace, or back trace in this case, to find where the the segmentation fault occures. What I don't know, though, how to do it. Can someone please point me out where I can get this information, or tell how to do it under Dev-Cpp? Thanks everyone. |
|
From: Per W. <pw...@ia...> - 2007-07-21 18:12:24
|
I never use the built-in debugger support in Dev-C++, but if you can get the application to fail in the debugger - or by running directly from gdb om command line, the back trace command (bt in command line version) will dump the call sequence where the application died. /pwm On Sat, 21 Jul 2007, Jamiil Abduqadir wrote: > Well, I would like to give you more information, but my problem is that I > don't know how to utilize Dev-Cpp's debugger to locate the problem. If you > know a trick to catch the problemed code, please let me know. > > Thanks in advance. > ----- Original Message ----- > From: "Adam Jones" <aj...@i-...> > To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'" > <dev...@li...> > Sent: Saturday, July 21, 2007 5:47 AM > Subject: RE: [Dev-C++] Segmentation Fault - Debugging > > > You Wrote: > > I have a segmentation fault in my program > > This usually indicates a pointer allocation problem. Check your pointers in > your program. Make sure they are allocated and initialized correctly before > using them. Without out knowing more about the code or what you are doing, > this is the only advice I can give at this point. > > -Adam Jones > > > From: dev...@li... > [mailto:dev...@li...] On Behalf Of Jamiil > Abduqadir > Sent: Saturday, July 21, 2007 10:37 AM > To: Dev Cpp MailingLinst > Subject: [Dev-C++] Segmentation Fault - Debugging > > Hello. > I have a segmentation fault in my program, I know that I could trace, or > back trace in this case, to find where the the segmentation fault occures. > What I don't know, though, how to do it. > Can someone please point me out where I can get this information, or tell > how to do it under Dev-Cpp? > > Thanks everyone. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Jamiil A. <jal...@gm...> - 2007-07-22 00:48:36
|
Per and Adam, thank you very much for the hand.
Using Per's suggetion I used the DOS prompt to run gdb and tb, and as
requested by Adam, here is the slice of code that is causing all the
problems.
hpp file
#include <glibmm/ustring.h>
....
Glib::ustring* str;
...
cpp file
if (str->empty()){str = new Glib::ustring("Unknown");}
...
'gdb' reports that the error is in basic_string.h, line 261. I am compiling
using mingw32 v 3.4.4
In a WinXP machine.
What has me comfused is that I am not using the std library, but the Glib
library; yet the error comes from the std library
Can anyone help?
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "Jamiil Abduqadir" <jal...@gm...>
Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'"
<dev...@li...>
Sent: Saturday, July 21, 2007 11:12 AM
Subject: Re: [Dev-C++] Segmentation Fault - Debugging
>I never use the built-in debugger support in Dev-C++, but if you can get
> the application to fail in the debugger - or by running directly from gdb
> om command line, the back trace command (bt in command line version) will
> dump the call sequence where the application died.
>
> /pwm
>
> On Sat, 21 Jul 2007, Jamiil Abduqadir wrote:
>
>> Well, I would like to give you more information, but my problem is that I
>> don't know how to utilize Dev-Cpp's debugger to locate the problem. If
>> you
>> know a trick to catch the problemed code, please let me know.
>>
>> Thanks in advance.
>> ----- Original Message -----
>> From: "Adam Jones" <aj...@i-...>
>> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'"
>> <dev...@li...>
>> Sent: Saturday, July 21, 2007 5:47 AM
>> Subject: RE: [Dev-C++] Segmentation Fault - Debugging
>>
>>
>> You Wrote:
>> > I have a segmentation fault in my program
>>
>> This usually indicates a pointer allocation problem. Check your pointers
>> in
>> your program. Make sure they are allocated and initialized correctly
>> before
>> using them. Without out knowing more about the code or what you are
>> doing,
>> this is the only advice I can give at this point.
>>
>> -Adam Jones
>>
>>
>> From: dev...@li...
>> [mailto:dev...@li...] On Behalf Of Jamiil
>> Abduqadir
>> Sent: Saturday, July 21, 2007 10:37 AM
>> To: Dev Cpp MailingLinst
>> Subject: [Dev-C++] Segmentation Fault - Debugging
>>
>> Hello.
>> I have a segmentation fault in my program, I know that I could trace, or
>> back trace in this case, to find where the the segmentation fault
>> occures.
>> What I don't know, though, how to do it.
>> Can someone please point me out where I can get this information, or tell
>> how to do it under Dev-Cpp?
>>
>> Thanks everyone.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Dev-cpp-users mailing list
>> Dev...@li...
>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>
|
|
From: Adam J. <aj...@i-...> - 2007-07-22 16:36:14
|
>> You wrote:
>> 'gdb' reports that the error is in basic_string.h, line 261. I am
compiling
>> using mingw32 v 3.4.4
>> In a WinXP machine.
>> What has me comfused is that I am not using the std library, but the Glib
>> library; yet the error comes from the std library
I haven't used Glib, but if you are getting that error, my suspicion is that
Glib my derived it's ustring from basic_string class template, and that is
why you are getting that reference to basic_string.h.
>> Glib::ustring* str;
As for why you are getting the error, again my suspicion from the code
fragment is that you make a declaration for the pointer (statement above),
but you don't have it pointing to anything before you test it (statement
below).
>> if (str->empty()){str = new Glib::ustring("Unknown");}
You need to assign it to something. What it is pointing to is undefined.
Pointers must point to something before you can use them. Unless you have
done that in code you have not shown us.
-Adam Jones
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Jamiil
Abduqadir
Sent: Saturday, July 21, 2007 11:52 PM
To: Per Westermark
Cc: 'Dev Cpp MailingLinst'
Subject: Re: [Dev-C++] Segmentation Fault - Debugging
Per and Adam, thank you very much for the hand.
Using Per's suggetion I used the DOS prompt to run gdb and tb, and as
requested by Adam, here is the slice of code that is causing all the
problems.
hpp file
#include <glibmm/ustring.h>
....
Glib::ustring* str;
...
cpp file
if (str->empty()){str = new Glib::ustring("Unknown");}
...
'gdb' reports that the error is in basic_string.h, line 261. I am compiling
using mingw32 v 3.4.4
In a WinXP machine.
What has me comfused is that I am not using the std library, but the Glib
library; yet the error comes from the std library
Can anyone help?
----- Original Message -----
From: "Per Westermark" <pw...@ia...>
To: "Jamiil Abduqadir" <jal...@gm...>
Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'"
<dev...@li...>
Sent: Saturday, July 21, 2007 11:12 AM
Subject: Re: [Dev-C++] Segmentation Fault - Debugging
>I never use the built-in debugger support in Dev-C++, but if you can get
> the application to fail in the debugger - or by running directly from gdb
> om command line, the back trace command (bt in command line version) will
> dump the call sequence where the application died.
>
> /pwm
>
> On Sat, 21 Jul 2007, Jamiil Abduqadir wrote:
>
>> Well, I would like to give you more information, but my problem is that I
>> don't know how to utilize Dev-Cpp's debugger to locate the problem. If
>> you
>> know a trick to catch the problemed code, please let me know.
>>
>> Thanks in advance.
>> ----- Original Message -----
>> From: "Adam Jones" <aj...@i-...>
>> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'"
>> <dev...@li...>
>> Sent: Saturday, July 21, 2007 5:47 AM
>> Subject: RE: [Dev-C++] Segmentation Fault - Debugging
>>
>>
>> You Wrote:
>> > I have a segmentation fault in my program
>>
>> This usually indicates a pointer allocation problem. Check your pointers
>> in
>> your program. Make sure they are allocated and initialized correctly
>> before
>> using them. Without out knowing more about the code or what you are
>> doing,
>> this is the only advice I can give at this point.
>>
>> -Adam Jones
>>
>>
>> From: dev...@li...
>> [mailto:dev...@li...] On Behalf Of Jamiil
>> Abduqadir
>> Sent: Saturday, July 21, 2007 10:37 AM
>> To: Dev Cpp MailingLinst
>> Subject: [Dev-C++] Segmentation Fault - Debugging
>>
>> Hello.
>> I have a segmentation fault in my program, I know that I could trace, or
>> back trace in this case, to find where the the segmentation fault
>> occures.
>> What I don't know, though, how to do it.
>> Can someone please point me out where I can get this information, or tell
>> how to do it under Dev-Cpp?
>>
>> Thanks everyone.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> Dev-cpp-users mailing list
>> Dev...@li...
>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Jamiil A. <jal...@gm...> - 2007-07-22 23:51:43
|
Yes Adam, thanks for the help, I have not tested the code or if what I think
the problem is actually true, but after you pointed out that before saing
"if (str->empty()){... " 'str' must point to someting, I realize that my
mistake is that a declared std::string pointer does not point to anything,
yet I am testing if it is empty() or not.
Well I am going to go check my/your understanding of the problem and its
solution.
Thanks Adam.
>
> I haven't used Glib, but if you are getting that error, my suspicion is
> that
> Glib my derived it's ustring from basic_string class template, and that is
> why you are getting that reference to basic_string.h.
>
>>> Glib::ustring* str;
>
> As for why you are getting the error, again my suspicion from the code
> fragment is that you make a declaration for the pointer (statement above),
> but you don't have it pointing to anything before you test it (statement
> below).
>
>>> if (str->empty()){str = new Glib::ustring("Unknown");}
>
> You need to assign it to something. What it is pointing to is undefined.
> Pointers must point to something before you can use them. Unless you have
> done that in code you have not shown us.
>
> -Adam Jones
>
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf Of Jamiil
> Abduqadir
> Sent: Saturday, July 21, 2007 11:52 PM
> To: Per Westermark
> Cc: 'Dev Cpp MailingLinst'
> Subject: Re: [Dev-C++] Segmentation Fault - Debugging
>
> Per and Adam, thank you very much for the hand.
> Using Per's suggetion I used the DOS prompt to run gdb and tb, and as
> requested by Adam, here is the slice of code that is causing all the
> problems.
> hpp file
> #include <glibmm/ustring.h>
> ....
> Glib::ustring* str;
> ...
> cpp file
> if (str->empty()){str = new Glib::ustring("Unknown");}
> ...
>
> 'gdb' reports that the error is in basic_string.h, line 261. I am
> compiling
> using mingw32 v 3.4.4
> In a WinXP machine.
> What has me comfused is that I am not using the std library, but the Glib
> library; yet the error comes from the std library
> Can anyone help?
> ----- Original Message -----
> From: "Per Westermark" <pw...@ia...>
> To: "Jamiil Abduqadir" <jal...@gm...>
> Cc: "Adam Jones" <aj...@i-...>; "'Dev Cpp MailingLinst'"
> <dev...@li...>
> Sent: Saturday, July 21, 2007 11:12 AM
> Subject: Re: [Dev-C++] Segmentation Fault - Debugging
>
>
>>I never use the built-in debugger support in Dev-C++, but if you can get
>> the application to fail in the debugger - or by running directly from gdb
>> om command line, the back trace command (bt in command line version) will
>> dump the call sequence where the application died.
>>
>> /pwm
>>
>> On Sat, 21 Jul 2007, Jamiil Abduqadir wrote:
>>
>>> Well, I would like to give you more information, but my problem is that
>>> I
>>> don't know how to utilize Dev-Cpp's debugger to locate the problem. If
>>> you
>>> know a trick to catch the problemed code, please let me know.
>>>
>>> Thanks in advance.
>>> ----- Original Message -----
>>> From: "Adam Jones" <aj...@i-...>
>>> To: "'Jamiil Abduqadir'" <jal...@gm...>; "'Dev Cpp MailingLinst'"
>>> <dev...@li...>
>>> Sent: Saturday, July 21, 2007 5:47 AM
>>> Subject: RE: [Dev-C++] Segmentation Fault - Debugging
>>>
>>>
>>> You Wrote:
>>> > I have a segmentation fault in my program
>>>
>>> This usually indicates a pointer allocation problem. Check your pointers
>>> in
>>> your program. Make sure they are allocated and initialized correctly
>>> before
>>> using them. Without out knowing more about the code or what you are
>>> doing,
>>> this is the only advice I can give at this point.
>>>
>>> -Adam Jones
>>>
>>>
>>> From: dev...@li...
>>> [mailto:dev...@li...] On Behalf Of Jamiil
>>> Abduqadir
>>> Sent: Saturday, July 21, 2007 10:37 AM
>>> To: Dev Cpp MailingLinst
>>> Subject: [Dev-C++] Segmentation Fault - Debugging
>>>
>>> Hello.
>>> I have a segmentation fault in my program, I know that I could trace, or
>>> back trace in this case, to find where the the segmentation fault
>>> occures.
>>> What I don't know, though, how to do it.
>>> Can someone please point me out where I can get this information, or
>>> tell
>>> how to do it under Dev-Cpp?
>>>
>>> Thanks everyone.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Splunk Inc.
>>> Still grepping through log files to find problems? Stop.
>>> Now Search log events and configuration files using AJAX and a browser.
>>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>>> _______________________________________________
>>> Dev-cpp-users mailing list
>>> Dev...@li...
>>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
>>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>>>
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|