Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Break point at exit
Break point at exit [message #77648] Thu, 31 July 2003 13:57 Go to next message
Eclipse UserFriend
Originally posted by: javaproject_7.hotmail.com

Hi All,

Is it possibe to put a break point at the exit so that GDB correctly
terminate at this point.

Now what happens is that since no break point is there the program goes to
infinite loop and we cannot send exit command to GDB.

Does the cdt has got such feature?.

Please let us know .

Thanks,
Jose
Re: Break point at exit [message #77697 is a reply to message #77648] Fri, 01 August 2003 00:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alain.nowhere.ca

Jose wrote:

> Hi All,

> Is it possibe to put a break point at the exit so that GDB correctly
> terminate at this point.

> Now what happens is that since no break point is there the program goes to
> infinite loop and we cannot send exit command to GDB.

> Does the cdt has got such feature?.

> Please let us know .

Are you saying that when you run the program in thd debugger
and it goes in a loop, that when you hit "terminate", the big
red square button in the debug view, The program and gdb does
not terminate ?

Now if you want to "suspend" a running program to examine
the stack and variables you have to hit the "suspend" button.

If you can not do none of the action describe above,
would like to know the Platform your are running, the gdb version.
Re: Break point at exit [message #77713 is a reply to message #77697] Fri, 01 August 2003 04:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: javaproject_7.hotmail.com

Hi Alain,

Here is the program I am using.

/*----------------------------------------------------
* eCos 'Hello world' example
* --------------------------------------------------*/

#include <stdio.h>
//#include "library_example.h"

int main(int argc, char* argv[])
{
int i;


for (i=0; i<10; i++)
{
printf("Hello world!\n\r");
}
return 0;
}


I am using GDB mipsel-elf-gdb.exe build GNU gdb 20030516.
My problem is that when I run the above program in command line it prints
Hello world
and is not returning to GDB.

One of the ecos GUY says that if we put a break point at exit it is possible
to exit the program.
What command we have use or does CDT has got support for putting a break
point at exit.

The terminate menu is enabled after printing Hello world but the program is
not able to sent the kill
command to hardware because it is not returning from the previous command.
So the terminate is not working as expected.

I am using Eclipse 2.1 and CDT 1.0.1.

Thanks in advance,
Jose















"alain" <alain@nowhere.ca> wrote in message news:bgcbph$44g$1@eclipse.org...
> Jose wrote:
>
> > Hi All,
>
> > Is it possibe to put a break point at the exit so that GDB correctly
> > terminate at this point.
>
> > Now what happens is that since no break point is there the program goes
to
> > infinite loop and we cannot send exit command to GDB.
>
> > Does the cdt has got such feature?.
>
> > Please let us know .
>
> Are you saying that when you run the program in thd debugger
> and it goes in a loop, that when you hit "terminate", the big
> red square button in the debug view, The program and gdb does
> not terminate ?
>
> Now if you want to "suspend" a running program to examine
> the stack and variables you have to hit the "suspend" button.
>
> If you can not do none of the action describe above,
> would like to know the Platform your are running, the gdb version.
>
>
Re: Break point at exit [message #77750 is a reply to message #77713] Fri, 01 August 2003 19:37 Go to previous message
Eclipse UserFriend
Originally posted by: alain.nowhere.ca

Jose wrote:

> Hi Alain,

> Here is the program I am using.

> /*----------------------------------------------------
> * eCos 'Hello world' example
> * --------------------------------------------------*/

> #include <stdio.h>
> //#include "library_example.h"

> int main(int argc, char* argv[])
> {
> int i;


> for (i=0; i<10; i++)
> {
> printf("Hello world!nr");
> }
> return 0;
> }


> I am using GDB mipsel-elf-gdb.exe build GNU gdb 20030516.
> My problem is that when I run the above program in command line it prints
> Hello world
> and is not returning to GDB.

> One of the ecos GUY says that if we put a break point at exit it is possible
> to exit the program.
> What command we have use or does CDT has got support for putting a break
> point at exit.

I do not know in vanilla GDB, a breakpoint type to make an application
stop at function exit. Maybe you should recontack that ecos fellow
and ask for clarification, it may be a GDB extension for ecos.

> The terminate menu is enabled after printing Hello world but the program is
> not able to sent the kill
> command to hardware because it is not returning from the previous command.
> So the terminate is not working as expected.

I admit .. to not follow your explication, but you could try a few things:

- Use the atexit() function
void bailout (void) {
fprintf(stderr, "going down\n"); // <-- put a breakpoint here in the
// CEditor
}
int main(...) {
...
atexit(bailout);
}

By setting some breakpoints in the bailout function
you should be able to stop before main() exit;


- Put a breakpoint on the last statement of main();

> I am using Eclipse 2.1 and CDT 1.0.1.

Rather old, should upgrade.
Previous Topic:Managed Build Change Notification
Next Topic:Control on loading a program
Goto Forum:
  


Current Time: Sat Oct 19 13:51:04 GMT 2024

Powered by FUDForum. Page generated in 0.03017 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top