public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Help with workflow
@ 2020-12-20 11:52 Patrick
  2020-12-20 12:24 ` Arnaud Charlet
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick @ 2020-12-20 11:52 UTC (permalink / raw)
  To: gcc

Hi Everyone

This is my first post here.

I need help mapping a enjoyable workflow from GnuCOBOL to GCC.

I love COBOL and with GnuCOBOL, I can compile one of my programs to 
intermediate C and then take the GnuCOBOL source code for the runtime 
and the C outputted and hop around though it using ctags.

It is great to write something in COBOL and then to see how it is 
actually implemented in the runtime in C.

I want to do the same thing with Ada.

This was my first attempt:

gcc -c -gnatDGL

but the output wasn't really that meaningful, it was basically just my 
program with no ctag links into the runtime.


I tried to create a little shell script :

gcc -c -fdump-tree-original-raw ada83_syntax.adb
gcc -c -fdump-tree-gimple-raw ada83_syntax.adb
gcc -c -fdump-tree-cfg-raw  ada83_syntax.adb

ctags ../*.[ch] ../ada/* *.original *.gimple *.cfg
gvim ../*.[ch] ../ada/* *.original *.gimple *.cfg tags

I was hoping that I would catch the top level C code and that it would 
help. It didn't seem to.

Could anyone help with what I am trying to do?

Thanks for reading-Pat



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

* Re: Help with workflow
  2020-12-20 11:52 Help with workflow Patrick
@ 2020-12-20 12:24 ` Arnaud Charlet
  2020-12-20 14:13   ` Patrick
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Charlet @ 2020-12-20 12:24 UTC (permalink / raw)
  To: Patrick; +Cc: gcc

Pat,

Not sure what you are trying to do . Are you trying to generate C code
from Ada? If so, can you clarify why? In other words, what is the high level
problem you are trying to solve and that you'd like to achieve? Is it the
ability to navigate in Ada code?

If you want to generate C from Ada, GCC isn't the right tool, since GCC
doesn't generate C code, it generates an intermediate representation which
is then translated into assembly code directly, without ever generating C code.

Arno

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

* Re: Help with workflow
  2020-12-20 12:24 ` Arnaud Charlet
@ 2020-12-20 14:13   ` Patrick
  2020-12-20 15:54     ` Arnaud Charlet
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick @ 2020-12-20 14:13 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: gcc

On 2020-12-20 7:24 a.m., Arnaud Charlet wrote:
> Pat,
>
> Not sure what you are trying to do . Are you trying to generate C code
> from Ada? If so, can you clarify why? In other words, what is the high level
> problem you are trying to solve and that you'd like to achieve? Is it the
> ability to navigate in Ada code?
>
> If you want to generate C from Ada, GCC isn't the right tool, since GCC
> doesn't generate C code, it generates an intermediate representation which
> is then translated into assembly code directly, without ever generating C code.
>
> Arno

Hi Arnaud

Thanks for responding to my post. I am not trying to generate C but to 
follow the intermediate representation into the Ada runtime.

So let's just say we had this:

*with*  Ada.Text_IO;
*use*   Ada.Text_IO;
*procedure*  Do_Delays*is*
*begin*
   Put_Line("Wait 5 seconds.");
   *delay*  5.0;
   Put_Line("Wait 2 seconds.");
   *delay*  2.0;
   Put_Line("Wait 7 seconds.");
   *delay*  7.0;
   Put_Line("That's all folks.");
*end*  Do_Delays;

I want to follow "delay" through the intermediate representation into the Ada runtime to see where the code actually causes a pause state to occur.

I can do this with GnuCOBOL because it compiles to C but that is not the case here and I can't seem to figure out how to follow the code as it is being translated through it's various stages and into the runtime.

Thanks again-Pat


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

* Re: Help with workflow
  2020-12-20 14:13   ` Patrick
@ 2020-12-20 15:54     ` Arnaud Charlet
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaud Charlet @ 2020-12-20 15:54 UTC (permalink / raw)
  To: Patrick; +Cc: gcc


> Thanks for responding to my post. I am not trying to generate C but to follow the intermediate representation into the Ada runtime.
> 
> So let's just say we had this:
> 
> with Ada.Text_IO;
> use  Ada.Text_IO;
> procedure Do_Delays is
> begin
>   Put_Line("Wait 5 seconds.");
>   delay 5.0;
>   Put_Line("Wait 2 seconds.");
>   delay 2.0;
>   Put_Line("Wait 7 seconds.");
>   delay 7.0;
>   Put_Line("That's all folks."); 
> end Do_Delays;
> 
> I want to follow "delay" through the intermediate representation into the Ada runtime to see where the code actually causes a pause state to occur.

Ok so you should indeed use -gnatDL and you will see these runtime calls materialize. The syntax of the .dg files is documented in gcc/ada/sprint.ads
> 
> I can do this with GnuCOBOL because it compiles to C but that is not the case here and I can't seem to figure out how to follow the code as it is being translated through it's various stages and into the runtime.
> 
> Thanks again-Pat

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

end of thread, other threads:[~2020-12-20 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20 11:52 Help with workflow Patrick
2020-12-20 12:24 ` Arnaud Charlet
2020-12-20 14:13   ` Patrick
2020-12-20 15:54     ` Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).