StackTrace C++ application

I have written a C++ stack application and running it using CYGWIN g++ compiler. The application crashes as exception is not handled perfectly.

It gives me stacktrace dump as a file Stack.exe.stackdump. I am new to this StackTrace thing could some one tell me how to read it and what does it signify?

Just to make clear based on received comments, The stack data structure is just an example to make the application crash and to give stackTrace. I mean this stack trace is generated in any situation when the program crashes and unrelated to my stack data structure application, which I just used as an existing code where program crashes.

My code fragment which generates exception :

class RuntimeException{
    private:
    string errorMsg;
    public:
    RuntimeException(const string& err){errorMsg = err;}
    string getMessage() const {return errorMsg;}
    };

class StackEmpty : public RuntimeException{
public:
StackEmpty(const string& err) : RuntimeException(err){}
};

template <typename E >
const E& ArrayStack<E> ::top() const throw(StackEmpty)
{

        if(empty()) throw StackEmpty("Top of Empty Stack");
        return S[t];

    }

int main()
{
    ArrayStack <int> A;

    cout << "######n";

    cout << A.top() << "n";
    cout << "######n";

    }

The Output :

$ ./Stack
######
Aborted (core dumped)

It generates a file Stack.exe.stackdump , which reads:

Stack trace:
Frame     Function  Args
0022A774  7608C313  (000000C0, 0000EA60, 00000000, 0022A8A8)
0022A788  7608C2C2  (000000C0, 0000EA60, 000000A4, 0022A884)
0022A8A8  610DC559  (00000000, 00000000, 00000000, 00000000)
0022A998  610D9913  (00000000, 6110073E, 003B0023, 00230000)
0022A9F8  610D9DEE  (0022A9D0, 6110073E, 003B0023, 00000006)
0022AAA8  610D9F40  (000008F4, 00000006, 00000000, 00000000)
0022AAC8  610D9F6C  (00000006, 00000006, 0022AB38, 00404C6B)
0022AAF8  610DA233  (0022AB28, 611A1E9B, 0022ABAC, 00000001)
0022AB48  00404777  (00000000, 00000000, 0022AC18, 004142CB)
0022AB58  00404166  (20048588, 004460E0, 00410F78, 0040F89F)
0022AC18  004142CB  (0022AC50, 00445218, 20010100, 004011B5)
0022AC68  004011EC  (00000001, 0022AC90, 20010100, 612756CA)
0022ACF8  6100763A  (00000000, 0022CD78, 61006C50, 00000000)
End of stack trace

I want to know what does this file signify and how to read it, googled a lot but could not find satisfactory answer.

Thanks


我会尝试解码在调试器中转储的内核。

gdb ./Stack.exe ./Stack.exe.stackdump

backtrace

This gives your the call stack at the point of the crash. This is unrelated to the stack data structure you appear to be attempting to implement.

For each function on the call stack, the stack dump is showing the stack pointer, the address of the function, and the first four arguments. Instead of trying to work with the stack dump, it might be easier to troubleshoot your program using a debugger.

链接地址: http://www.djcxy.com/p/15096.html

上一篇: Android中向上和向后按钮的区别

下一篇: StackTrace C ++应用程序