473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Debugging bizzare error help needed

BCC
I am getting a non-reproduceable release mode only error, that is
proving to be really a pain. I can in some cases narrow it down by
try/catch blocks but even that behavior is totally f*ed up.

For example, I have this gem:
try {
int x = Foo();
}
catch (...) {
int x = Foo();
}

Foo() blows up and throws, but when it is caught, it -works-. WTF?

Seems like a memory problem, but Ive tried all kinds of release mode
debugging (map files, purify, etc.) but nothing pins it down.

Has anyone seen any behavior like this before? Any pearls of wisdom out
there?

Thanks,
B
Sep 22 '05 #1
8 1170

"BCC" <bc*@abcz.com> wrote in message
news:ln*****************@newssvr27.news.prodigy.ne t...
I am getting a non-reproduceable release mode only error, that is proving
to be really a pain. I can in some cases narrow it down by try/catch
blocks but even that behavior is totally f*ed up.

For example, I have this gem:
try {
int x = Foo();
}
catch (...) {
int x = Foo();
}

Foo() blows up and throws, but when it is caught, it -works-. WTF?

Seems like a memory problem, but Ive tried all kinds of release mode
debugging (map files, purify, etc.) but nothing pins it down.

Has anyone seen any behavior like this before? Any pearls of wisdom out
there?

Your probably going to have to give more information. My guess is that the
first call of Foo is setting up some state that lets the second one work.

For example:

int Foo()
{
static int y = 0;
if (y == 0)
{
y++;
throw...
};
};
Simple but concise example of showing how something like that could happen.

Ofcourse since it works with debugging is probably being caused by memory
allocation/deallocation. It really depends on Foo, as you surely have
figured out... but you have not given anything about what Foo is. You
should try to find the smallest subset of code that reproduces the error
then post that.

Jon Thanks,
B

Sep 22 '05 #2

"BCC" <bc*@abcz.com> wrote in message
news:ln*****************@newssvr27.news.prodigy.ne t...
I am getting a non-reproduceable release mode only error, that is proving
to be really a pain. I can in some cases narrow it down by try/catch
blocks but even that behavior is totally f*ed up.

For example, I have this gem:
try {
int x = Foo();
}
catch (...) {
int x = Foo();
}

Foo() blows up and throws, but when it is caught, it -works-. WTF?
There's absolutely no way for us to diagnose the problem
without at least seeing the definition of 'Foo()'. Also
there's the possibility that something went wrong previously
in some other unrelated part of you program, rendering
'undefined behavior', whereupon *anything* might happen,
and the same thing might or might not happen during
subsequent runs of the program.

Seems like a memory problem,
What causes you to think that? (I'm not saying it's not
a memory problem, but the limited information you give
contains no clues pointing in that direction).
but Ive tried all kinds of release mode debugging (map files, purify, etc.)
but nothing pins it down.
Try paring down your code to the smallest program that
still reproduces the error. If you still can't find it,
post the code.

Has anyone seen any behavior like this before?
I certainly have.
Any pearls of wisdom out there?


Perhaps there are, but we need more information.

-Mike
Sep 22 '05 #3
BCC
Perhaps there are, but we need more information.

-Mike


Thats kind of the problem. My 'Foo()' example is just one of the more
prevalent places it blows up. It also croaks in several other
functions, from what I can tell completely at random.

So there seems to be no use posting the contents of Foo(). But, in the
event I am wrong, here is what Foo does:

double CMCal::GetMass(double x) const
{
double m = 0.0;
if(inverse_function)
{
double d = mass_a[1] * x + mass_a[2];
if (d < 0) throw NoSuchMass();

d = sqrt(d) - 1.0;
m = mass_a[0] * d * d;
}
else {
m = (((mass_a[2] * x) + mass_a[1]) * x + mass_a[0]);
}

return m;
}

mass_a is just an array of 3 doubles.

I also know that NoSuchMass() is -not- being thrown, as catching it has
no effect.

B
Sep 23 '05 #4

"BCC" <bc*@abcz.com> wrote in message
news:NT****************@newssvr29.news.prodigy.net ...
Perhaps there are, but we need more information.

-Mike
Thats kind of the problem. My 'Foo()' example is just one of the more
prevalent places it blows up. It also croaks in several other functions,
from what I can tell completely at random.


That's exactly why I suggested to reduce your program to
a smaller one which gives the same problem. Often in
the process of doing this, you'll discover the trouble.

So there seems to be no use posting the contents of Foo().
If you post code that fails when it calls 'Foo()', how
are we to determine the problem if you won't post the
code in 'Foo()'?
But, in the event I am wrong, here is what Foo does:

double CMCal::GetMass(double x) const
{
double m = 0.0;
if(inverse_function)
{
double d = mass_a[1] * x + mass_a[2];
if (d < 0) throw NoSuchMass();

d = sqrt(d) - 1.0;
m = mass_a[0] * d * d;
}
else {
m = (((mass_a[2] * x) + mass_a[1]) * x + mass_a[0]);
}

return m;
}
Huh? That function's name is 'GetMass()'. Did you just
'make up' that name 'Foo'? Post the *real* code.

mass_a is just an array of 3 doubles.
But what are the values of the array elements? Did you
look at them with a debugger?

I also know that NoSuchMass() is -not- being thrown, as catching it has no
effect.


You don't show full context (such as where you're catching
NoSuchMass'. (BTW is 'NoSuchMass' a type or the name of
a function which returns some other type?)

So again, I say, "not enough information".

-Mike
Sep 23 '05 #5
BCC


Huh? That function's name is 'GetMass()'. Did you just
'make up' that name 'Foo'? Post the *real* code.

Have you ever seen a -real- function called 'Foo()'? Of course it was
made up.
mass_a is just an array of 3 doubles.

But what are the values of the array elements? Did you
look at them with a debugger?


Yep. I have also dumped them out after catching the exception in
release mode. They are fine.
You don't show full context (such as where you're catching
NoSuchMass'. (BTW is 'NoSuchMass' a type or the name of
a function which returns some other type?)
NoSuchMass is a class.
So again, I say, "not enough information".


And there we are. Full context would require posting waaaaaay more code
that is reasonable, or legal. There is no specific section as of yet to
pinpoint, so to boil down this code to the simplest form that reproduces
the problem would take quite some time (although I may get there). But
again, for legal reasons I dont think I could post the code even if I did.

I was more hoping that this type of issue represents some kind of well
known memory error.

At any rate, Ill find it.

B
Sep 23 '05 #6

"BCC" <bc*@abcz.com> wrote in message
news:qO****************@newssvr12.news.prodigy.com ...


Huh? That function's name is 'GetMass()'. Did you just
'make up' that name 'Foo'? Post the *real* code.

Have you ever seen a -real- function called 'Foo()'?


Yes.
Of course it was made up.
So you're making us guess. Why not post the real code?
That's what's giving you trouble, right?
mass_a is just an array of 3 doubles.

But what are the values of the array elements? Did you
look at them with a debugger?


Yep. I have also dumped them out after catching the exception in release
mode. They are fine.


"They are fine" tells us nothing. What are the *values*?
You don't show full context (such as where you're catching
NoSuchMass'. (BTW is 'NoSuchMass' a type or the name of
a function which returns some other type?)
NoSuchMass is a class.
So again, I say, "not enough information".


And there we are. Full context would require posting waaaaaay more code
that is reasonable, or legal. There is no specific section as of yet to
pinpoint, so to boil down this code to the simplest form that reproduces
the problem would take quite some time (although I may get there). But
again, for legal reasons I dont think I could post the code even if I did.


But you could create a small program to simulate the
part of the larger one that's causing trouble. IF it
works correctly, then you'll know to look elsewhere.

I was more hoping that this type of issue represents some kind of well
known memory error.
We can't know, because you gave so little information.

At any rate, Ill find it.


Good luck. :-)

-Mike
Sep 23 '05 #7
>>
Have you ever seen a -real- function called 'Foo()'?


Yes.


Did it by any chance return the value 42?

:o)
Sep 24 '05 #8
>
Has anyone seen any behavior like this before? Any pearls of wisdom out
there?

Thanks,
B


I my experience release version errors which don't exist in debug
version are usually caused by uninitialised variables.

john
Sep 24 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Richard Gutery | last post by:
I have an ASP page that I need to have a Message Box on. When I try to run the page, I get the following message : Exception Not Handled. Permission Denied. To trouble shoot, I gave everyone...
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
1
by: Chris Raudabaugh | last post by:
Error Msg: Error while trying to run project: Unable to start debugging on the web server. Access is denied. After many hours of scanning MS KB's, newsgroups, and msdn trying all of the...
7
by: Martin Pritchard | last post by:
Hi, Sorry for my ignorance, but I'm a bit new to C++. I've been handed over a C++ app written in VS2002 which I have to convert to VS2005. Apparently it's been written in a C style, but cannot...
4
by: Sheldon | last post by:
Hi, I would like to view the contents of structure as part of a debugging routine. The structure is represented by a pointer ptr->data. I would like to view the first element in the array,...
10
by: Doug Robertson | last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm completely self taught - so bear in mind my total lack of expertise. I have a program originally written in VB2003 using...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.