* what are the created ~b files when using -g with gnatmake @ 2003-07-16 15:59 srouse 2003-07-16 17:45 ` David C. Hoos 0 siblings, 1 reply; 5+ messages in thread From: srouse @ 2003-07-16 15:59 UTC (permalink / raw) when I do a gnatmake with the -g option for debugging it creates new ~b*.adb, ~b*.ads, ~b*.ali, and ~b*.o files. I was wondering what these files are and how they are used when debugging the ada program? Thanks for the help! Shawn ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what are the created ~b files when using -g with gnatmake 2003-07-16 15:59 what are the created ~b files when using -g with gnatmake srouse @ 2003-07-16 17:45 ` David C. Hoos 2003-07-16 22:04 ` srouse 0 siblings, 1 reply; 5+ messages in thread From: David C. Hoos @ 2003-07-16 17:45 UTC (permalink / raw) To: srouse, comp.lang.ada ----- Original Message ----- From: "srouse" <srouse@iastate.edu> Newsgroups: comp.lang.ada To: <comp.lang.ada@ada.eu.org> Sent: Wednesday, July 16, 2003 10:59 AM Subject: what are the created ~b files when using -g with gnatmake > when I do a gnatmake with the -g option for debugging it creates new > ~b*.adb, ~b*.ads, ~b*.ali, and ~b*.o files. I was wondering what > these files are and how they are used when debugging the ada program? First, let me say that these files are _not_ named "~b*.adb, ~b*.ads, ~b*.ali, and ~b*.o", but rather "b~*.adb, b~*.ads, b~*.ali, and b~*.o". Next, let me say that these files are created regardless of whether the -g option is used. What is different with the -g option is that the files are not deleted at the completion of the gnatmake process, because they are potentially needed when debugging. The best way to find out what things are for in the GNAT compilation system is to read the documentation provided with GNAT. Here is a pertinent excerpt from that documentation: If no errors are detected, the binder produces a main program, in Ada by default, that contains calls to the elaboration procedures of those compilation unit that require them, followed by a call to the main program. This Ada program is compiled to generate the object file for the main program. The name of the Ada file is `b~xxx.adb' (with the corresponding spec `b~xxx.ads') where xxx is the name of the main program unit. > > Thanks for the help! > Shawn > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what are the created ~b files when using -g with gnatmake 2003-07-16 17:45 ` David C. Hoos @ 2003-07-16 22:04 ` srouse 2003-07-17 17:43 ` Jano 2003-07-17 18:22 ` David C. Hoos 0 siblings, 2 replies; 5+ messages in thread From: srouse @ 2003-07-16 22:04 UTC (permalink / raw) Thank you for your help! Sorry about the "~b" typo! I have a couple more questions though... I'm creating an IDE for Ada in Eclipse and working on the debugger right now, so I'm trying to get a knowledge of how to debug Ada programs. All my code is programmed in Java so I'm very familiar with how to debug Java programs. With a Java program I step through the code that I have written. This is what I don't understand: If I have a project in GPS and go to debug it, I step through the created b~xxx.adb file. Why would I not step through the xxx.adb file? I have been looking through the gnat user guide and gnatgdb debugger doc a great deal, but I still don't understand why the debugger steps through the b~xxx.adb file and not the xxx.adb file. Thank you for any additional help! Shawn "David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message news:<mailman.12.1058377576.24167.comp.lang.ada@ada.eu.org>... > ----- Original Message ----- > From: "srouse" <srouse@iastate.edu> > Newsgroups: comp.lang.ada > To: <comp.lang.ada@ada.eu.org> > Sent: Wednesday, July 16, 2003 10:59 AM > Subject: what are the created ~b files when using -g with gnatmake > > > > when I do a gnatmake with the -g option for debugging it creates new > > ~b*.adb, ~b*.ads, ~b*.ali, and ~b*.o files. I was wondering what > > these files are and how they are used when debugging the ada program? > > First, let me say that these files are _not_ named "~b*.adb, ~b*.ads, > ~b*.ali, and ~b*.o", but rather "b~*.adb, b~*.ads, b~*.ali, and b~*.o". > > Next, let me say that these files are created regardless of whether the -g > option is used. What is different with the -g option is that the files are > not deleted at the completion of the gnatmake process, because they are > potentially needed when debugging. > > The best way to find out what things are for in the GNAT compilation > system is to read the documentation provided with GNAT. > > Here is a pertinent excerpt from that documentation: > > If no errors are detected, the binder produces a main program, in Ada > by default, that contains calls to the elaboration procedures of those > compilation unit that require them, followed by a call to the main program. > This Ada program is compiled to generate the object file for the main > program. The name of the Ada file is `b~xxx.adb' (with the > corresponding spec `b~xxx.ads') where xxx is the name of the main > program unit. > > > > > Thanks for the help! > > Shawn > > _______________________________________________ > > comp.lang.ada mailing list > > comp.lang.ada@ada.eu.org > > http://ada.eu.org/mailman/listinfo/comp.lang.ada > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what are the created ~b files when using -g with gnatmake 2003-07-16 22:04 ` srouse @ 2003-07-17 17:43 ` Jano 2003-07-17 18:22 ` David C. Hoos 1 sibling, 0 replies; 5+ messages in thread From: Jano @ 2003-07-17 17:43 UTC (permalink / raw) srouse dice... > I have been looking through the gnat user guide and gnatgdb debugger > doc a great deal, but I still don't understand why the debugger steps > through the b~xxx.adb file and not the xxx.adb file. I suppose you'll arrive to the main xxx.adb file when elaboration (b~*.adb) ends. Or you can place a breakpoint at your main procedure first line. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: what are the created ~b files when using -g with gnatmake 2003-07-16 22:04 ` srouse 2003-07-17 17:43 ` Jano @ 2003-07-17 18:22 ` David C. Hoos 1 sibling, 0 replies; 5+ messages in thread From: David C. Hoos @ 2003-07-17 18:22 UTC (permalink / raw) To: comp.lang.ada; +Cc: srouse ----- Original Message ----- From: "srouse" <srouse@iastate.edu> Newsgroups: comp.lang.ada To: <comp.lang.ada@ada.eu.org> Sent: Wednesday, July 16, 2003 5:04 PM Subject: Re: what are the created ~b files when using -g with gnatmake > Thank you for your help! > > Sorry about the "~b" typo! > > I have a couple more questions though... > > I'm creating an IDE for Ada in Eclipse and working on the debugger > right now, so I'm trying to get a knowledge of how to debug Ada > programs. All my code is programmed in Java so I'm very familiar with > how to debug Java programs. With a Java program I step through the > code that I have written. > > This is what I don't understand: > > If I have a project in GPS and go to debug it, I step through the > created b~xxx.adb file. Why would I not step through the xxx.adb > file? > > I have been looking through the gnat user guide and gnatgdb debugger > doc a great deal, but I still don't understand why the debugger steps > through the b~xxx.adb file and not the xxx.adb file. > Here is a fragment of the file b~wc.adb produyced by building a small program of mine. Every b~*.adb file will have such a "main" function to correspond to the "main" function of a typeical "C" program. They are all pretty much alike except for the names of entities related to the name of your main (Ada) procedure. Your main procedure is given the name "Ada_Main_Program" within this file, and you will see that "main" calls it after having called Initialize, adainit, and Break_Start. function main (argc : Integer; argv : System.Address; envp : System.Address) return Integer is procedure initialize; pragma Import (C, initialize, "__gnat_initialize"); procedure finalize; pragma Import (C, finalize, "__gnat_finalize"); procedure Ada_Main_Program; pragma Import (Ada, Ada_Main_Program, "_ada_wc"); Ensure_Reference : System.Address := Ada_Main_Program_Name'Address; begin gnat_argc := argc; gnat_argv := argv; gnat_envp := envp; Initialize; adainit; Break_Start; Ada_Main_Program; Do_Finalize; Finalize; return (gnat_exit_status); end; You probably need to do some reading on the subject of "elaboration" in Ada, which is what is being cone by the "adainit" procedure. If you want to skip stepping through the elaboration code, you can set a breakpoint on the Break_Start procedure (which exists just for this purpose), and from there you will step into your main program. Sometimes, however, there can be problems in elaboration code (e.g., in someone's library that you "withed" into your program). Then, you will need to step through that elaboration code which will be one of the procedures called from within "adainit." This is admittedly just a cursory ecplanation of what goes on, and actually stepping through an "adainit" procedure will teach you a lot about what's going on "under the hood." ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-07-17 18:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-07-16 15:59 what are the created ~b files when using -g with gnatmake srouse 2003-07-16 17:45 ` David C. Hoos 2003-07-16 22:04 ` srouse 2003-07-17 17:43 ` Jano 2003-07-17 18:22 ` David C. Hoos
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox