comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <rm-dash-bau-haus@dash.futureapps.de>
Subject: Re: Where would you start debugging?
Date: Thu, 27 Jun 2013 16:33:57 +0200
Date: 2013-06-27T16:33:57+02:00	[thread overview]
Message-ID: <51cc4d55$0$6637$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <8b4c7660-3f0b-41a2-9cc3-2ab1c595e182@googlegroups.com>

On 27.06.13 15:53, Peter Brooks wrote:
> I've written a small package, there's not much point in putting it here. The moment I run it it is giving me this error:
>
> raised CONSTRAINT_ERROR : erroneous memory access
>
> I'm using gnat on a Mac. The odd thing is that this happens when the calling program simply has a 'with' statement mentioning the package, there's no need to call it.
>
> So, it's clearly part of the iniitalisation of the package.
>
> Where should I start debugging?

If the with-ed package is yours, -gnatVa, -gnatwa, -fstack-check,
and -gnato could help as they add more checks and warnings.
-gnatE and -gnata might also help.

In case the with-ed package is from the run-time system or similar,
I'd add GNAT switches -x, -a, and possibly -m to the above.

Before starting gdb, I'd try a tool like valgrind (of which XCode
has an equivalent IIRC.)

>  should I forget this method and just parse the string manually?

Will 'Value do?

    type Enum is (Yeah, Bee, See);

    ...

    declare
       use Ada.Command_Line;
       Test : Enum;
    begin
       Test := Enum'Value (Argument (1));
       Text_IO.Put_Line (Natural'Image (Enum'Pos (Test)));
    exception
       when Constraint_Error =>
          -- ...
    end;



  parent reply	other threads:[~2013-06-27 14:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 13:53 Where would you start debugging? Peter Brooks
2013-06-27 14:24 ` Peter Brooks
2013-06-27 14:33 ` G.B. [this message]
2013-06-28 10:35   ` Peter Brooks
replies disabled

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