Re: How to check what underlying commands are called by gcc?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2021-04-21 at 16:40 -0500, Peng Yu wrote:

> Just telling others to read textbooks is not helpful. It is more
> constructive to provide specific references.

By that I mean you didn't even read the resources "everyone can find", 
i. e. CS:APP, and GCC manual or man pages.  Or at least you didn't read
them seriously. And many (at least 50%) of your questions can be
answered simply by pasting the question into Google, press Enter, and
click on the first result from https://stackoverflow.com.

> On Wed, Apr 21, 2021 at 3:10 PM Jonathan Wakely
> <jwakely.gcc@xxxxxxxxx> wrote:
> > On Wed, 21 Apr 2021 at 20:40, Peng Yu wrote:
> > > 
> > > On Wed, Apr 21, 2021 at 2:22 PM Jonathan Wakely
> > <jwakely.gcc@xxxxxxxxx> wrote:
> > > > It would probably be possible, but it would not be practical (as
> > mentioned, not all systems that GCC runs on have a good shell). The
> > GCC drivers do a lot more than just launch other processes, so
> > "shell
> > scripts are good for launching other processes" isn't a good enough
> > reason to do it. Also "shell scripts are easier to maintain" is
> > subjective,
> > > 
> > > This is a general conclusion from the first principle. As long as
> > the
> > > purpose is to glue things, shell should be by definition better
> > (given
> > > the misconceptions that need to avoided when using shell).
> > 
> > You are assuming its purpose is just "to glue things".
> > 
> 
> 
> No. That is not my assumption. I am saying for the part that is
> suitable for gluing, a shell is better used. For the part that is not
> suitable for gluing, it can stay in C.

There is not so much gluing thing in the driver.  Maybe 10%. It's just
you focused on gluing and didn't really read the code.

And, with a correctly designed C++ API (gcc is in C++ now, why all of us
was saying C? :), invoking of external programs won't be more difficult
than using shell.  A rational programmer should not split his program
apart and "glue" the parts again using shell, *only* because the program
invokes several external programs.

Back to consider your original purpose, you think using shell will let
you see the commands "clearly". To make the shell echo the commands
executed, you need to invoke the script with "bash -x".  Then the
command will become "bash -x $(which gcc)". I don't think it's better
than "gcc -v" anyway.

Maybe you mean you can open the shell script with vim (or anything) and
see the commands "clearly"?  No, 99% of the commands are not hard-coded.
They are constructed by some program routines and in a shell script the
routines will be *more* complex.  And GCC is GPL'ed, so you can always
read its code at https://gcc.gnu.org/git.

Again, if you really believe shell is better you can fork GCC and modify
the code with whatever you want.
-- 
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux