From: Arthur Schwarz <aschwarz1309@att.net>
To: gdb@sourceware.org
Subject: SIGSERV termination on return statement
Date: Tue, 09 Oct 2012 21:48:00 -0000 [thread overview]
Message-ID: <1349819318.23713.YahooMailRC@web181302.mail.ne1.yahoo.com> (raw)
Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_03
Runtime = Java HotSpot(TM) Client VM 22.1-b02
Cygwin gcc 4.5.3
gdb 4.5.3
I'm debugging my C++ software using Netbeans and gdb 4.5.3 (integrated into the
IDE) and I get a fatal error on the return from a method. The fault is
consistent in that there is a failure in the same place in my code with the same
caller all the time, and inconsistent in that there is no failure under other
conditions. I am perfectly willing to accept the fault as mine but I can't seem
to find the fault with gdb (and, hence, unable to fix it).
The circumstances are:
when I have 'a = method()' with '=' overloaded there is always a failure on
the method return.
when I have 'method()' with no assignment there is no failure.
I have set a breakpoint in the overloaded assignment code but the breakpoint is
never executed (?).
The code is shown below (as an aid?). Any idea how I can use gdb to isolate the
point of failure? As a note, the overload architecture looks like:
class SlipCell {
virtual SlipCell& operator=(SlipCell& X) = 0;
}
class SlipDatum: public SlipCell {
virtual SlipCell& operator=(SlipCell& X); // code in .cpp file
}
class SlipHeader: public SlipCell {
virtual SlipCell^ operator=(SlipCell& X); // code in .cpp file
}
class SlipSublist: public SlipCell {
virtual SlipCell& operator=(SlipCell& X); // code in .cpp file
}
The code where the failure occurs is:
[code]
SlipCell& SlipSublist::replace(SlipCell& X) { // Replace a cell
on a list with a new cell
SlipCell& cell = *this;
if (X.isData()) {
cell = assignData(X); // failure before return to this statement from
method
delete this;
} else {
*this = X;
}
return cell;
}; // SlipCell& SlipSublist::replace(SlipCell& X)
SlipCell& SlipSublist::assignData(SlipCell& X) { // Assign a
sublist to the current cell
SlipCell* cell = this;
if (isTemp()) {
postError(SlipErr::E2036, "replace", "", "", this, &X);
} else {
if (X.isData()) {
cell = &X;
if (X.isTemp()) {
cell = new SlipDatum((SlipDatum&)X);
} else if (!X.isUnlinked()) {
postError(SlipErr::E2039, "replace", "", "", this, &X);
return *this;
}
replaceLinks(*cell);
} else {
SlipHeader* header = &(SlipHeader&)X;
SlipHeader* oldHeader = (SlipHeader*)*getSublistHeader();
if (X.isSublist()) {
header = (SlipHeader*)*getSublistHeader(X);
} else if (!X.isHeader()) {
postError(SlipErr::E3020, "replace", "", " Must be a Header,
Sublist or Datum", this);
return *cell;
}
*getSublistHeader() = header;
(*getHeadRefCnt(*header))++;
delete oldHeader;
}
}
return *cell; //failure seems to be after the return statement is
executed and before the return
//to the caller and the overloaded '=' operator is never
entered.
}; // SlipCell& SlipSublist::assignData(SlipCell& X)
[/code]
I can't debug without a debugger. It would be useful to know that this is my
error (I have misunderstood C++) or whether it is a debugger issue. And I would
really like to know how to bypass any fault in the debugger (if there is one).
This problem has dogged me for the last month or so - I have worked around it in
most cases but now it's time to stop the bleeding.
thanks
PS: If my syntax is garbled or the presentation poor please provide guidance and
not condemnation.
next reply other threads:[~2012-10-09 21:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 21:48 Arthur Schwarz [this message]
2012-10-09 23:32 ` Aurelian Melinte
2012-10-10 16:01 ` Arthur Schwarz
2012-10-11 0:27 ` Aurelian Melinte
2012-10-11 9:40 ` John Gilmore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349819318.23713.YahooMailRC@web181302.mail.ne1.yahoo.com \
--to=aschwarz1309@att.net \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox