comp.lang.ada
 help / color / mirror / Atom feed
* Debugging Problem with Gnatbench under Eclipse
@ 2013-11-11  2:27 Fritz von Braun
  2013-11-11  5:40 ` Jeffrey Carter
  2014-02-10 17:40 ` john
  0 siblings, 2 replies; 13+ messages in thread
From: Fritz von Braun @ 2013-11-11  2:27 UTC (permalink / raw)


Hello,

I am new to Ada, Eclipse and newsgroups so I may just make some dumb mistake here, but I cant figure out how to correct this, I searched the web over and over but could not find any help with this problem.

I installed the latest Eclipse 32 bit version, the CDT tools and Gnatbench just as described. I created a small Hello World program which compiles and runs just fine. But when I try to start it under the Eclipse GDB debugger I get the following error:

Error in final launch sequence
Failed to execute MI command:
-data-evaluate-expression "sizeof (void*)"
Error message from debugger back end:
No definition of "sizeof" in current context.
No definition of "sizeof" in current context.

Debugging a C++ program in Eclipse works. I tried all sorts of combination with the Debugging configurations offered when starting Ada debugging but they all create the same error.

Any help would be appreciated

Thanks

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-11  2:27 Debugging Problem with Gnatbench under Eclipse Fritz von Braun
@ 2013-11-11  5:40 ` Jeffrey Carter
  2013-11-11 16:20   ` Mike H
  2014-02-10 17:40 ` john
  1 sibling, 1 reply; 13+ messages in thread
From: Jeffrey Carter @ 2013-11-11  5:40 UTC (permalink / raw)


On 11/10/2013 07:27 PM, Fritz von Braun wrote:
>
> I am new to Ada, Eclipse and newsgroups so I may just make some dumb mistake
> here, but I cant figure out how to correct this, I searched the web over and
> over but could not find any help with this problem.
>
> I installed the latest Eclipse 32 bit version, the CDT tools and Gnatbench
> just as described. I created a small Hello World program which compiles and
> runs just fine. But when I try to start it under the Eclipse GDB debugger I
> get the following error:

My experience has been that one rarely needs a debugger with Ada, so my advice 
would be not to worry about it.

-- 
Jeff Carter
"C++ is like giving an AK-47 to a monk, shooting him
full of crack and letting him loose in a mall and
expecting him to balance your checking account
'when he has the time.'"
Drew Olbrich
52

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-11  5:40 ` Jeffrey Carter
@ 2013-11-11 16:20   ` Mike H
  2013-11-12  0:46     ` Fritz von Braun
  0 siblings, 1 reply; 13+ messages in thread
From: Mike H @ 2013-11-11 16:20 UTC (permalink / raw)


Jeffrey Carter wrote ...
>My experience has been that one rarely needs a debugger with Ada, so my 
>advice would be not to worry about it.
>
This 80-year-old would second that!

Imagine that you are working in an environment where peer review of your 
written code is a normal part of the signing off process and then write 
(and comment) your code appropriately.
-- 
Who is General Failure and why is he reading my hard disc?
Mike

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-11 16:20   ` Mike H
@ 2013-11-12  0:46     ` Fritz von Braun
  2013-11-12 14:40       ` Mike H
  0 siblings, 1 reply; 13+ messages in thread
From: Fritz von Braun @ 2013-11-12  0:46 UTC (permalink / raw)


LOL yes, well I am a messed up person, coming from 20 years of C and C++ programming, Ok, I used to do Pascal and Modula2 before, thats the reason I want to see if I can use Ada now because I missed those, but working without a debugger feels to me like a blind man in a tunnel during a power outage. For now, I am using Adacore's GPS, the same program debugs there without a problem, although I think the IDE is a bit more confusing than Eclipse. Maybe I will use some sort of hybrid model where I edit the program in Eclipse and then debug in GPS, that works too.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-12  0:46     ` Fritz von Braun
@ 2013-11-12 14:40       ` Mike H
  2013-11-12 17:43         ` Bill Findlay
  2013-11-13  1:12         ` Adam Beneschan
  0 siblings, 2 replies; 13+ messages in thread
From: Mike H @ 2013-11-12 14:40 UTC (permalink / raw)


In message <3d734e02-f7eb-4a32-86ca-0d56e059e276@googlegroups.com>, 
Fritz von Braun <fritzvonbraun@gmail.com> writes
>LOL yes, well I am a messed up person, coming from 20 years of C and 
>C++ programming, Ok, I used to do Pascal and Modula2 before, thats the 
>reason I want to see if I can use Ada now because I missed those, but 
>working without a debugger feels to me like a blind man in a tunnel 
>during a power outage. For now, I am using Adacore's GPS, the same 
>program debugs there without a problem, although I think the IDE is a 
>bit more confusing than Eclipse. Maybe I will use some sort of hybrid 
>model where I edit the program in Eclipse and then debug in GPS, that 
>works too.
>
Hi Fritz,

I started in the late 1960's when I was a school teacher (Maths and 
Physics) and my first real experience of computing was (courtesy of a 
parent) taking a class of 17/18-year-olds to see an Elliot 803. Among 
the happier memories of my being a pedagogue is dealing with very bright 
youngsters, they and I learned Algol 60 together. In those days, it was 
a case of, "In the land of the blind the one-eyed man is king" and I 
talked my way into a job with a major insurance group. There it was 
COBOL! Later it was adult education teaching at undergraduate level. 
Those were my Algol 68, Pascal and Modula2 days and, since I was 
attracted by ideas of programming as an engineering discipline, when Ada 
83 arrived it came as a gift from heaven.

In the UK education provision and politics are inextricably mixed and, 
in my opinion, education has suffered from too many ill-advised reforms 
coming too quickly. So when the opportunity arose, I took early 
retirement and turned a medium pension into a good one by using my Ada 
skills as a contract programmer. Nearly all my experience in industry 
was working on safety-related projects (nuclear power, air defence, 
heavy weaponry, etc.). Not once did I use a debugger! If an Ada program 
is well written (and I use that phrase advisedly) the compiler becomes a 
first line of defence. One assumes that if the program compiles, it will 
do what the source code says, nothing more and nothing less. If it does 
not do what you believe it should do, the source code must be wrong. At 
that point you have to swallow your pride and seek help from a colleague 
(peer review!). I have never thought of that as debugging, perhaps it 
means that Ada debugging is more usually done at source code level?

I hope you do not think that I am trying to teach my grandmother how to 
suck an egg when I say that I think the biggest change of thought 
processes when moving to Ada is starting to use the strict typing rules 
as a tool to one's advantage. An obvious example is a "bug" arising from 
arithmetic on a pair measurements one of which is metric and the other 
imperial. Another would be having a submarine dive to a depth above 
sea-level. One aims to ensure that such potential bugs can and should 
killed as compilation errors (at best) or trapped as non-propagated 
run-time exceptions (at worst). But it goes much deeper than that. In my 
teaching days I would throw a class the question of whether time and 
duration are interchangeable. The "lesson objective" was to convince 
them that they are not. For example, the difference between two times is 
not a time, it is a duration. The sum of two times is a meaningless 
error but the sum of two durations is a duration. A time plus or minus a 
duration is a time, and so it goes on. Coding such a set of rules into a 
package may be a bit tedious but it is simple and routine. More 
importantly,  not to do so in a safety related system it would be 
unprofessional (and potentially extremely expensive for one's employer).
-- 
Time flies like an arrow. Fruit flies like a banana.
Mike


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-12 14:40       ` Mike H
@ 2013-11-12 17:43         ` Bill Findlay
  2013-11-13  1:12         ` Adam Beneschan
  1 sibling, 0 replies; 13+ messages in thread
From: Bill Findlay @ 2013-11-12 17:43 UTC (permalink / raw)


On 12/11/2013 14:40, in article 45AGpDFh3jgSFwmZ@ada-augusta.demon.co.uk,
"Mike H" <postmaster@ada-augusta.demon.co.uk> wrote:

> In message <3d734e02-f7eb-4a32-86ca-0d56e059e276@googlegroups.com>,
> Fritz von Braun <fritzvonbraun@gmail.com> writes
>> LOL yes, well I am a messed up person, coming from 20 years of C and
>> C++ programming,

You have my profound sympathhy, Fritz.

> ... using my Ada skills ... Not once did I use a debugger!

Ditto.  I have about 75K SLOC of relatively complex Ada 2005/2012 code in 3
major current projects and some smaller ones.

Not a single line has been defiled by the clammy paws of a "debugger".

I once raced a very experienced programmer who was using a debugger on his
Ada program, while I examined his source code.

I found his error before he did.

-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-12 14:40       ` Mike H
  2013-11-12 17:43         ` Bill Findlay
@ 2013-11-13  1:12         ` Adam Beneschan
  2013-11-13  8:18           ` Georg Bauhaus
  2013-11-13  9:14           ` Mike H
  1 sibling, 2 replies; 13+ messages in thread
From: Adam Beneschan @ 2013-11-13  1:12 UTC (permalink / raw)


On Tuesday, November 12, 2013 6:40:33 AM UTC-8, Mike H wrote:

> One assumes that if the program compiles, it will 
> do what the source code says, nothing more and nothing less. If it does 
> not do what you believe it should do, the source code must be wrong. At 
> that point you have to swallow your pride and seek help from a colleague 
> (peer review!). I have never thought of that as debugging, perhaps it 
> means that Ada debugging is more usually done at source code level?

"Debugging", as I understand it, just means eliminating bugs (errors) from the program.  And Ada programs often do have bugs in them.  Ada has nice features that prevent certain kinds of errors that plague C and C++ programmers, but it does not prevent programmers from using an algorithm that doesn't work, or making a mistake when typing in an algorithm (although I hear that ARG is working on adding mind-reading features to Ada 202X that would help with that).  If your conception of "debugging" means examining machine instructions and registers and memory dumps, then that would explain why this discussion is confusing to me.  If a subprogram isn't working, because the source code is wrong, being able to step through it and examine the variables as they're computed can be a useful tool to help figure out what's going wrong.  It's a tool I definitely use.  It's not the only tool; I rely on my instincts to tell me whether to use a debugger, stick some Put_Lines into the code, or just study it harder, or something else.  But yes, this is almost always source-level debugging, using a debugger that understands Ada variables and types and works at that level.  It's rare that I'd have to resort to a memory dump or disassembly, unless perhaps there's an Unchecked_Conversion or dangling access causing a problem (or when I suspect a compiler bug).

I could be a little biased here, since the Ada debugger I use is one that I wrote.  So the suggestions on this thread, that debuggers are largely irrelevant to Ada programmers, is one that gets my dander up a bit.  They can be useful tools.  And I'd encourage the OP to try to get the vendor to fix the problem, since it's a tool he might find useful in the future.

                                -- Adam


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-13  1:12         ` Adam Beneschan
@ 2013-11-13  8:18           ` Georg Bauhaus
  2013-11-13  9:11             ` Dmitry A. Kazakov
  2013-11-13 17:37             ` Jeffrey Carter
  2013-11-13  9:14           ` Mike H
  1 sibling, 2 replies; 13+ messages in thread
From: Georg Bauhaus @ 2013-11-13  8:18 UTC (permalink / raw)


On 13.11.13 02:12, Adam Beneschan wrote:
> So the suggestions on this thread, that debuggers are largely irrelevant to Ada programmers, is one that gets my dander up a bit.  They can be useful tools.  And I'd encourage the OP to try to get the vendor to fix the problem, since it's a tool he might find useful in the future.


Could it be that Ada programmers just don't know debuggers? 8-)

Debuggers turn my unforgiving CPU into a much more lenient interpreter,
Its steps are under my control.

Debuggers provide for a kind of "virtual machine", or extended machine.
They add features with uses for the programmer without him or her adding
a single line of source text. I can manipulate the program as is, I can
see call chains easily, at every instruction I choose, in circumstances
I choose.

This turns debuggers into programmable simulators. They will assist,
for example, with test driven development. (Which includes finding bugs
in logic that do not have counterparts among the exceptions.) For example,

- Debuggers can test my assumptions (debugging a solution) like:
do I see actual parameters that I expected to be passed to procedure Foo
when the program calls Foo for the third time?

- Debuggers make me think of possible cases (debugging the specification):
Oh, I missed the case where 42 could end up in x.y.

During my daily (non-Ada) work, I sometimes wish I could use a debugger,
as adding all sorts of trace statements and then scanning log files
is cumbersome.

Even gdb, used with or without fancy Expect (or ELisp) programming,
understands the "commands" command.

So, for instance, a debugger procedure can
1 Stop at F in this situation
2 Show what's in the variables x, y, and z
3 IF y IS NOT IN {1,...,64} THEN:
3a show the call chain
3b set y to a known good value
4 continue



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-13  8:18           ` Georg Bauhaus
@ 2013-11-13  9:11             ` Dmitry A. Kazakov
  2013-11-13 10:17               ` Simon Wright
  2013-11-13 17:37             ` Jeffrey Carter
  1 sibling, 1 reply; 13+ messages in thread
From: Dmitry A. Kazakov @ 2013-11-13  9:11 UTC (permalink / raw)


On Wed, 13 Nov 2013 09:18:07 +0100, Georg Bauhaus wrote:

> Could it be that Ada programmers just don't know debuggers? 8-)

Those who used DEC Ada surely knew excellent VMS debugger. ObjectAda too
had a decent debugger in its time.

But GDB is unusable with Ada, which Ada programmers know...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-13  1:12         ` Adam Beneschan
  2013-11-13  8:18           ` Georg Bauhaus
@ 2013-11-13  9:14           ` Mike H
  1 sibling, 0 replies; 13+ messages in thread
From: Mike H @ 2013-11-13  9:14 UTC (permalink / raw)


Adam Beneschan <adambeneschan@aol.com> writes ...
>So the suggestions on this thread, that debuggers are largely 
>irrelevant to Ada programmers, is one that gets my dander up a bit.
Perhaps an explanation might be appropriate.

Neither as a college lecturer nor as a contract programmer (safety 
related code), did I ever use a debugger. The reason is that I never 
worked in an environment where (to my knowledge) a debugger was 
available. Hence, having no experience of debugging other than reference 
to the program specification, inspection of the source code and 
temporary modification of the source code, I cannot make any comment 
concerning the relevance or otherwise of other debugging tools and 
methods.

-- 
"Why," said Ford squatting down beside him and shivering, "are you lying face
down in the dust?" "It's a very effective way of being wretched," said Marvin.
Mike ;-(

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-13  9:11             ` Dmitry A. Kazakov
@ 2013-11-13 10:17               ` Simon Wright
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Wright @ 2013-11-13 10:17 UTC (permalink / raw)


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> But GDB is unusable with Ada, which Ada programmers know...

gdb is far from perfect, but it's difficult enough to use that I only do
so as a last resort. I think that "unusable" is going a bit too far,
though.

I've never been strongly enough motivated to try the Emacs interface
(GUD?), I'd normally fall back on GPS if I need to debug.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-13  8:18           ` Georg Bauhaus
  2013-11-13  9:11             ` Dmitry A. Kazakov
@ 2013-11-13 17:37             ` Jeffrey Carter
  1 sibling, 0 replies; 13+ messages in thread
From: Jeffrey Carter @ 2013-11-13 17:37 UTC (permalink / raw)


On 11/13/2013 01:18 AM, Georg Bauhaus wrote:
>
> Could it be that Ada programmers just don't know debuggers? 8-)
>
> Debuggers turn my unforgiving CPU into a much more lenient interpreter,
> Its steps are under my control.
>
> Debuggers provide for a kind of "virtual machine", or extended machine.
> They add features with uses for the programmer without him or her adding
> a single line of source text. I can manipulate the program as is, I can
> see call chains easily, at every instruction I choose, in circumstances
> I choose.

I have used debuggers, and am familiar with what they do. Still it has been over 
a decade since I used one.

Most errors have nice exceptions that point me directly to the problem. Most 
others I can find quickly by drawing on my knowledge of the system and my 
experience. This leaves few errors that call for more extensive facilities. As 
Beneschan has pointed out, some of these are such that it's best to add some 
additional logging to find out what's happening. This leaves very few errors 
where a debugger would be a good choice.

Very often, my work has involved embedded targets with no debugging capabilities.

But sometimes I work on system with debuggers available, yet I still rarely use 
a debugger. While a debugger has powerful capabilities, these come with a 
learning curve. Often I am using a different tool chain since the last time I 
used a debugger; even when that is not the case, I have usually forgotten how to 
use it.

It is almost always more efficient use of my time to use additional logging 
rather than learning how to use the debugger. As a result, I rarely use them.

Finally, it's important to remember that my response was to someone coming from 
C/++. The vast majority of what such people are accustomed to using a debugger 
to find is impossible in Ada. The compiler catches most of them, and the 
remainder cause those nice exceptions I mentioned above rather than creating 
memory corruption. I'm sure that the OP, once he's had some experience with Ada, 
will agree that, compared to C/++, one rarely needs a debugger with Ada.

-- 
Jeff Carter
"Alms for an ex-leper!"
Monty Python's Life of Brian
75

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Debugging Problem with Gnatbench under Eclipse
  2013-11-11  2:27 Debugging Problem with Gnatbench under Eclipse Fritz von Braun
  2013-11-11  5:40 ` Jeffrey Carter
@ 2014-02-10 17:40 ` john
  1 sibling, 0 replies; 13+ messages in thread
From: john @ 2014-02-10 17:40 UTC (permalink / raw)


On Monday, 11 November 2013 02:27:12 UTC, Fritz von Braun  wrote:

> I installed the latest Eclipse 32 bit version, the CDT tools and Gnatbench just as described. I created a small Hello World program which compiles and runs just fine. But when I try to start it under the Eclipse GDB debugger I get the following error:
> 
> Error in final launch sequence
> Failed to execute MI command:
> -data-evaluate-expression "sizeof (void*)"
> Error message from debugger back end:
> No definition of "sizeof" in current context.
> No definition of "sizeof" in current context.

Hi Fritz,

I just wondered if you'd ever found a solution to this that doesn't involve going external to Eclipse's debugging facilities. I'm intending to present a very brief summary of Ada's facilities for defining representations to a bunch of uninterested C++ programmers and would like to show them the difference between, e.g., a record with and without its representation defined by stepping through and showing the changes to the object in memory. It would be nice to do this in Eclipse as I'm familiar with that, and it's pretty, but I suppose I could do it in GPS if I could find a way of having multiple memory views that update automatically!

All the best
John

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-02-10 17:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-11  2:27 Debugging Problem with Gnatbench under Eclipse Fritz von Braun
2013-11-11  5:40 ` Jeffrey Carter
2013-11-11 16:20   ` Mike H
2013-11-12  0:46     ` Fritz von Braun
2013-11-12 14:40       ` Mike H
2013-11-12 17:43         ` Bill Findlay
2013-11-13  1:12         ` Adam Beneschan
2013-11-13  8:18           ` Georg Bauhaus
2013-11-13  9:11             ` Dmitry A. Kazakov
2013-11-13 10:17               ` Simon Wright
2013-11-13 17:37             ` Jeffrey Carter
2013-11-13  9:14           ` Mike H
2014-02-10 17:40 ` john

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox