Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problem in making program stop on first line(I'm trying but failing to make my program stop in the first line)
Problem in making program stop on first line [message #1817010] Wed, 13 November 2019 19:07 Go to next message
Gerry Wolff is currently offline Gerry WolffFriend
Messages: 6
Registered: October 2019
Junior Member
With Eclipse IDE version 2019-09 (4.13.0) I would like to stop my C++ program at the first line. I have tried putting a tick in the box for "Stop on startup at main" (under Run/debug configuration), also a break point on the first line, and I have also put a breakpoint immediately after the first line, but the program simply exits leaving the message:

"<terminated>LANG2 Debug [C/C++ Application]
<terminated, exit value: 0>gdb (8.1.1) "

I have also tried removing the tick for "Stop on startup at main" but the same thing happens.

The program begins like this:

B int main(int argc, char *argv[])
{
B if (argc < 3)

I've put 'B' on lines that have break points.

Is this a bug or is there something wrong with my program? Any suggestions will be very welcome.
Re: Problem in making program stop on first line [message #1817059 is a reply to message #1817010] Thu, 14 November 2019 21:11 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
All I can say at this point is it works for me.
The debugger only stops at executable lines.
That is,those with control statements, expressions or function calls.
The first executable line in your program is the if statement.
The line beginning with int main is a declaration.
Putting a breakpoint there won't do anything
(although it will likely stop at the next executable line)

There are some things to check:

    o)Does your source match the executable (has it been built without errors)?

    o)There are different type of breakpoints selected with (right click in margin, Breakpoint Types)
    make sure they are C/C++ Breakpoints (tiny blue dot)

    o)Make sure Skip All Breakpoints hasn't been enabled
    (blue dot with slash in Breakpoints view)


Try creating an HelloWorld Project and see if breakpoints work there.

If that works, upload a short version of your code (about 10 lines or less) that doesn't.
Also, upload

    the launch configuration Main and Debugger Tabs
    the launch configuration type (C++ Application, Docker, whatever)
    the output displayed in the debugger console view
    your OS version.



Re: Problem in making program stop on first line [message #1817085 is a reply to message #1817059] Fri, 15 November 2019 10:12 Go to previous message
Gerry Wolff is currently offline Gerry WolffFriend
Messages: 6
Registered: October 2019
Junior Member
Dear David,

Many thanks for these very helpful suggestions. I'll be following them up as time allows.

With best wishes,

Gerry Wolff
Previous Topic:What happened to setting compiler options ?
Next Topic:Error limit increase for C++ compiler
Goto Forum:
  


Current Time: Thu Apr 25 14:40:13 GMT 2024

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

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

Back to the top