Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 175315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:40:37+00:00 2026-05-11T13:40:37+00:00

Can gcc spit out, given a C file, a list of the all function

  • 0

Can gcc spit out, given a C file, a list of the all function calls that occur, with filename and line number both for the call itself and for the function’s declaration?

I know gcc somehow retains this information with -g (debuggers rely on it) and that it can dump control flow graphs with -dr (but without filenames or line numbers); but is there a ready-to-use tool that takes gcc output and does what I want?

The reason I want such a tool to use gcc is that this will allow me to use it with the standard build system most gcc-based software comes with (e.g. ./configure && make) even in cases where tools that rely on their own preprocessor and/or parser are a major hassle to fit in. I’m already aware of several such tools, e.g. ctags. So this question is a followup to question 525899.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:40:38+00:00Added an answer on May 11, 2026 at 1:40 pm

    Try gcc option -fdump-tree-fixupcfg-lineno.

    It will ‘pretty print’ parsing AST (with line numbers) in a way that can easily be parsed using relatively simple lexer or any regex engine. Just find all non-keywords preceded by ‘=’ and followed by ‘(‘ – it will be function calls.

    All complex expressions will be split into several lines so no two function calls will appear on one line.

    Take simple program:

    #include <stdio.h> #include <stdlib.h> #include <math.h>  #define PI (3.1415926536)  int main(int argc, char *argv[]) {     double  angle = PI / 2.0;     printf('Sine = %lf, cosine = %lf\n', sin(angle), cos(angle));     return EXIT_SUCCESS; } 

    Compile it with -fdump-tree-fixupcfg-lineno and you get something like this:

    main (argc, argv) {   double angle;   int D.3381;   double D.3380;   double D.3379;    # BLOCK 2, starting at line 8   # PRED: ENTRY (fallthru)   [test.c : 8] angle = 1.57079632680000003119857865385711193084716796875e+0;   [test.c : 9] D.3379 = [test.c : 9] cos (angle);   [test.c : 9] D.3380 = [test.c : 9] sin (angle);   [test.c : 9] printf (&'Sine = %lf, cosine = %lf\n'[0], D.3380, D.3379);   [test.c : 10] D.3381 = 0;   return D.3381;   # SUCC: EXIT  } 

    You won’t get any complex expressions – just assignments and function call and no CPP macros, very easy to parse. Loops and conditionals don’t make it much more difficult.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 146k
  • Answers 147k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer input .Select((value, index) => new { PairNum = index /… May 12, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer CPU designs appear to be evolving towards hardware support for… May 12, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Finally found a converter that works as expected. Works for… May 12, 2026 at 9:06 am

Related Questions

I am aware that on most GNU/Linux systems, GCC can be invoked by the
How do I tell if gcc (more specifically, g++) is optimizing tail recursion in
GCC is a very well respected multi-language compiler (from what I've gathered). One thing
Are there compilers for high-level languages (such as C) which can be targeted to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.