gdb Doesn't See Locals After try/catch

In the included program, the variable y is not recognized by gdb. If it’s
definition is moved up to a broader scope near x, or the try/catch is
removed, everything’s fine. Is this a known bug? Anybody know a
fix/workaround? I’ve tried stabs and dwarf-2 with no improvement.

Thanks,
Marty Doane

#include <iostream.h>

int main(int argc, char* argv[])
{
int x;
try
{
x = 3;
}
catch (…)
{
cout << “We should not get here” << endl;
}
while (x > 0)
{
int y;
y = 4*x;
cout << "y = " << y << endl;
x–;
}
}

Hmmm, this appears to be a gdb bug at first glance, since your variable
is mentioned in the debug info.

BTW - for a glimpse of just how diabolical C++ is, take a look at the
assembly generated for this program! ;v)

Marty Doane <doanemr@rapistan.com> wrote:

In the included program, the variable y is not recognized by gdb. If it’s
definition is moved up to a broader scope near x, or the try/catch is
removed, everything’s fine. Is this a known bug? Anybody know a
fix/workaround? I’ve tried stabs and dwarf-2 with no improvement.

Thanks,
Marty Doane

#include <iostream.h

int main(int argc, char* argv[])
{
int x;
try
{
x = 3;
}
catch (…)
{
cout << “We should not get here” << endl;
}
while (x > 0)
{
int y;
y = 4*x;
cout << "y = " << y << endl;
x–;
}
}


cburgess@qnx.com

Colin Burgess <cburgess@qnx.com> wrote:

Hmmm, this appears to be a gdb bug at first glance, since your variable
is mentioned in the debug info.

BTW - for a glimpse of just how diabolical C++ is, take a look at the
assembly generated for this program! ;v)

Also, I just noticed that you were posting this in the QNX4 forum - next
time please post to qnxrtp.devtools.

Ta,

Colin

Marty Doane <> doanemr@rapistan.com> > wrote:
In the included program, the variable y is not recognized by gdb. If it’s
definition is moved up to a broader scope near x, or the try/catch is
removed, everything’s fine. Is this a known bug? Anybody know a
fix/workaround? I’ve tried stabs and dwarf-2 with no improvement.

Thanks,
Marty Doane

#include <iostream.h

int main(int argc, char* argv[])
{
int x;
try
{
x = 3;
}
catch (…)
{
cout << “We should not get here” << endl;
}
while (x > 0)
{
int y;
y = 4*x;
cout << "y = " << y << endl;
x–;
}
}


cburgess@qnx.com


cburgess@qnx.com

So sorrry for the wrong posting. I don’t quite know how that happened. This
is a QNX 6 question.

Yes, it is a gdb issue. We’ve also confirmed it in Linux. I was hoping
somebody knew a fix or workaround.

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:9me4g9$eil$1@nntp.qnx.com

Hmmm, this appears to be a gdb bug at first glance, since your variable
is mentioned in the debug info.

BTW - for a glimpse of just how diabolical C++ is, take a look at the
assembly generated for this program! ;v)

Marty Doane <> doanemr@rapistan.com> > wrote:
In the included program, the variable y is not recognized by gdb. If
it’s
definition is moved up to a broader scope near x, or the try/catch is
removed, everything’s fine. Is this a known bug? Anybody know a
fix/workaround? I’ve tried stabs and dwarf-2 with no improvement.

Thanks,
Marty Doane

#include <iostream.h

int main(int argc, char* argv[])
{
int x;
try
{
x = 3;
}
catch (…)
{
cout << “We should not get here” << endl;
}
while (x > 0)
{
int y;
y = 4*x;
cout << "y = " << y << endl;
x–;
}
}



\

cburgess@qnx.com