comp.lang.ada
 help / color / mirror / Atom feed
* Re: How to convert a certain value to text
       [not found] <5e8adbd9$0$18429$e4fe514c@news.kpn.nl>
@ 2020-04-06 10:38 ` J-P. Rosen
  2020-04-06 12:59 ` Simon Wright
  1 sibling, 0 replies; 8+ messages in thread
From: J-P. Rosen @ 2020-04-06 10:38 UTC (permalink / raw)


Le 06/04/2020 à 09:35, ldries46 a écrit :
> I am testing a program that makes the following Error:
> *raised CONSTRAINT_ERROR : glade_convert.adb:286 access check failed
> *That happens on the line
> *Get_Iter_At_Mark(Buffer, Iter_With, with_mark);
> * When running the program in debug mode the program never reaches this
> line and seems to be in a loop somewhere. That means that I do want to
> try and print some values in run modeThat must be the values of f.i.
> with_mark but while compiling I get image attribute cannot be used for a
> no scalar.
> How can I still print it.
> 
> I am using GNAT GPL 2019.
> 
If you want to trace your program, package Debug can be handy:
https://adalog.fr/compo/debug.htm

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

* Re: How to convert a certain value to text
       [not found] <5e8adbd9$0$18429$e4fe514c@news.kpn.nl>
  2020-04-06 10:38 ` How to convert a certain value to text J-P. Rosen
@ 2020-04-06 12:59 ` Simon Wright
  2020-04-06 14:02   ` ldries46
  2020-05-10  7:15   ` Simon Wright
  1 sibling, 2 replies; 8+ messages in thread
From: Simon Wright @ 2020-04-06 12:59 UTC (permalink / raw)


ldries46 <bertus.dries@planet.nl> writes:

> I am testing a program that makes the following Error:
> raised CONSTRAINT_ERROR : glade_convert.adb:286 access check failed
> That happens on the line
> Get_Iter_At_Mark(Buffer, Iter_With, with_mark);
>  When running the program in debug mode the program never reaches this
> line and seems to be in a loop somewhere. That means that I do want to
> try and print some values in run modeThat must be the values of
> f.i. with_mark but while compiling I get image attribute cannot be
> used for a no scalar.
> How can I still print it.

You write your own function Image to convert the type to string (you
may have to take extra measures if that type is private, e.g. makint
that function a child of the package in which the type is declared).

Or, you could learn to use the debugger?

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

* Re: How to convert a certain value to text
  2020-04-06 12:59 ` Simon Wright
@ 2020-04-06 14:02   ` ldries46
  2020-04-06 21:52     ` Oliver Kellogg
  2020-05-10  7:15   ` Simon Wright
  1 sibling, 1 reply; 8+ messages in thread
From: ldries46 @ 2020-04-06 14:02 UTC (permalink / raw)


Op 6-4-2020 om 14:59 schreef Simon Wright:
> ldries46 <bertus.dries@planet.nl> writes:
>
>> I am testing a program that makes the following Error:
>> raised CONSTRAINT_ERROR : glade_convert.adb:286 access check failed
>> That happens on the line
>> Get_Iter_At_Mark(Buffer, Iter_With, with_mark);
>>   When running the program in debug mode the program never reaches this
>> line and seems to be in a loop somewhere. That means that I do want to
>> try and print some values in run modeThat must be the values of
>> f.i. with_mark but while compiling I get image attribute cannot be
>> used for a no scalar.
>> How can I still print it.
> You write your own function Image to convert the type to string (you
> may have to take extra measures if that type is private, e.g. makint
> that function a child of the package in which the type is declared).
>
> Or, you could learn to use the debugger?
I am sorry but I think I know how to use the debugger. But the debugger 
does not stop a line 286 although i have set a breakpoint at the start 
of that line. I have added a lot of statements later on to follow where 
the program is and now I can stop at line 285. I have tried all the 
tricks from the past when the olderr version of the debugger still was 
around (I mean the version with the graphical interface). Writing my own 
version of image is not an option because I only have to know which 
parameter of the procedure creates the constraint error Buffer, 
Iter_With or with_mark

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

* Re: How to convert a certain value to text
  2020-04-06 14:02   ` ldries46
@ 2020-04-06 21:52     ` Oliver Kellogg
  2020-04-12 16:38       ` Stephen Leake
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver Kellogg @ 2020-04-06 21:52 UTC (permalink / raw)


On Monday, April 6, 2020 at 4:02:41 PM UTC+2, ldries46 wrote:
> [...] But the debugger 
> does not stop a line 286 although i have set a breakpoint at the start 
> of that line. I have added a lot of statements later on to follow where 
> the program is and now I can stop at line 285.

Recently I had a problem just like this.
The solution in my case was to switch off optimization on compiling (-O0).

HTH,

Oliver

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

* Re: How to convert a certain value to text
  2020-04-06 21:52     ` Oliver Kellogg
@ 2020-04-12 16:38       ` Stephen Leake
  2020-05-09 21:09         ` Oliver Kellogg
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Leake @ 2020-04-12 16:38 UTC (permalink / raw)


On Monday, April 6, 2020 at 2:52:13 PM UTC-7, Oliver Kellogg wrote:
> On Monday, April 6, 2020 at 4:02:41 PM UTC+2, ldries46 wrote:
> > [...] But the debugger 
> > does not stop a line 286 although i have set a breakpoint at the start 
> > of that line. I have added a lot of statements later on to follow where 
> > the program is and now I can stop at line 285.
> 
> Recently I had a problem just like this.
> The solution in my case was to switch off optimization on compiling (-O0).
> 
> HTH,
> 
> Oliver

better is -Og; "optimize for debugging"

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

* Re: How to convert a certain value to text
  2020-04-12 16:38       ` Stephen Leake
@ 2020-05-09 21:09         ` Oliver Kellogg
  2020-05-10  7:30           ` J-P. Rosen
  0 siblings, 1 reply; 8+ messages in thread
From: Oliver Kellogg @ 2020-05-09 21:09 UTC (permalink / raw)


Actually, I've had disappointing experiences with *-Og* , in particular on trying to inspect function arguments and local variables. Most of the time GDB said "optimized out" or similar. Tried it on various GCC versions <= 8.

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

* Re: How to convert a certain value to text
  2020-04-06 12:59 ` Simon Wright
  2020-04-06 14:02   ` ldries46
@ 2020-05-10  7:15   ` Simon Wright
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Wright @ 2020-05-10  7:15 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> ldries46 <bertus.dries@planet.nl> writes:
>
>>  When running the program in debug mode the program never reaches this
>> line and seems to be in a loop somewhere.
[...]
> Or, you could learn to use the debugger?

My apologies, I must have been having a bad day

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

* Re: How to convert a certain value to text
  2020-05-09 21:09         ` Oliver Kellogg
@ 2020-05-10  7:30           ` J-P. Rosen
  0 siblings, 0 replies; 8+ messages in thread
From: J-P. Rosen @ 2020-05-10  7:30 UTC (permalink / raw)


Le 09/05/2020 à 23:09, Oliver Kellogg a écrit :
> Actually, I've had disappointing experiences with *-Og* , in
> particular on trying to inspect function arguments and local
> variables. Most of the time GDB said "optimized out" or similar.
> Tried it on various GCC versions <= 8.
> 
Yes, GCC is very good at eliminating/optimizing unnecessary variables.
If you want to inspect your code "as written", use -O0

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

end of thread, other threads:[~2020-05-10  7:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5e8adbd9$0$18429$e4fe514c@news.kpn.nl>
2020-04-06 10:38 ` How to convert a certain value to text J-P. Rosen
2020-04-06 12:59 ` Simon Wright
2020-04-06 14:02   ` ldries46
2020-04-06 21:52     ` Oliver Kellogg
2020-04-12 16:38       ` Stephen Leake
2020-05-09 21:09         ` Oliver Kellogg
2020-05-10  7:30           ` J-P. Rosen
2020-05-10  7:15   ` Simon Wright

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