Code runs fine on the cmd line but crashes in gdb

Hi,

I have a C++ program that calls a large library of functions. I have built it and can execute it successfully from the command line in ubuntu. I would like to step through the code in order to see what is going on in some of the functions that it calls. I am using gdb to do this. However, at a certain point in the code gdb reports a "terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc".

How come the code can execute on the command line, but terminates in gdb?

Many thanks,
Greer
Probably there is undefined behavior somewhere. Say, usage of uninitialized variable or something like this.

Debuggers often set traps to catch that and force program to crash now instead of waiting for it to break in most uncomfortable moment.

What line is it? What is being allocated there? Which variables are used? Where they were last changed?
Topic archived. No new replies allowed.