This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Ada] warning: file name does not match unit name





On 14 Nov 2001, Andreas Schwab wrote:
  That looks pretty much like an off-by-one error.  I tried to debug this,
  but gdb-5.0.92 does not grok DW_FORM_strp and bails out.  Where is this
  file name computed, and how do I do printf-style debugging in Ada?

For general Ada programs, one would use Put_Line. Also note that using the
GNAT-specific 'Img attribute is useful for outputting integers and floats:
  Put_Line ("The value of X is " & X'Img & ", and Y is " & Y'Img & ".");

For debugging GNAT itself, use the debugging output routines in output.ads,
however.  These are more convenient and do not depend on a target-specific
runtime library.

  -Geert

(excerpt from output.ads):

   --------------------------
   -- Debugging Procedures --
   --------------------------

   --  The following procedures are intended only for debugging purposes,
   --  for temporary insertion into the text in environments where a debugger
   --  is not available. They all have non-standard very short lower case
   --  names, precisely to make sure that they are only used for debugging!

   procedure w (C : Character);
   --  Dump quote, character quote, followed by line return

   procedure w (S : String);
   --  Dump string followed by line return

   procedure w (V : Int);
   --  Dump integer followed by line return

   procedure w (B : Boolean);
   --  Dump Boolean followed by line return

   procedure w (L : String; C : Character);
   --  Dump contents of string followed by blank, quote, character, quote

   procedure w (L : String; S : String);
   --  Dump two strings separated by blanks, followed by line return

   procedure w (L : String; V : Int);
   --  Dump contents of string followed by blank, integer, line return

   procedure w (L : String; B : Boolean);
   --  Dump contents of string followed by blank, Boolean, line return


You might also want to look at sprint.ads and treepr.ads to print source
code and tree dumps of GNAT nodes. Last but not least there is a set
of debugging options, documented in debug.adb. The reason the documentation
is kept with the source here, is that these debugging flags change very
often and without warning. Specific options are included for testing out new 
features that we do not want to document at the user level. 

  -Geert


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]