bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"No symbol" after try - catch


From: g.u.g.i
Subject: "No symbol" after try - catch
Date: Fri, 28 Dec 2001 01:09:45 +0100

Hi,
I think I have found a bug in GDB 5.0.

GDB seems to have problems with a sequence like:
try {/*...*/}
catch(/*...*/) {/*...*/}
if(/*...*/) {/*...*/}
It does not recognize any variable in the if-block.

I'm using SuSE Linux 7.1 with Kernel 2.2.18 on a x86 PC.
As installed the gdb package from the SuSE distribution I don't know what
compiler was used to compile GDB.
I compiled the following source using gcc-2.95.2:
g++ -g gdbtest.cpp

If you set a breakpoint in the if-block after the line
int x = 123;
and type "print x" gdb says:
No symbol "x" in current context.
If you type "info locals" gdb says:
__exception_info = (cp_eh_info *) 0x7b
a = 1
c = 123
but nothing about x.

--------------------------gdbtest.cpp--------------------------------
#include <iostream>
int main()
{
    int a = 2;
    cout << "a = " << a << endl;
    try
    {
        a = 1;
    }
    catch(...)
    {
        cout << "exception" << endl;
        return -1;
    }

    if(true)
    {
        int x=123;
        cout << "a = " << a << endl;
        cout << "x = " << x << endl;
    }

    int c = 1;
    cout << "a = " << a << endl;
    cout << "c = " << c << endl;
    return 0;
}
---------------------------------------------------------------------

If this is an already well-known bug or I  did something wrong I'm sorry as
I'm quite new to gdb.
But I didn't find any information about this.


Jan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]