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

  • SEARCH
  • Home
  • 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 202125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:15:35+00:00 2026-05-11T17:15:35+00:00

Has anybody added a pass to gcc ? or not really a pass but

  • 0

Has anybody added a pass to gcc ? or not really a pass but adding an option to do some nasty things… 🙂 …

I still have the same problem about calling a function just before returning from another…so I would like to investigate it by implementing something in gcc…

Cheers.

EDIT: Adding a pass to a compiler means revisiting the tree to perform some optimizations or some analysis. I would like to emulate the behavior of __cyg_profile_func_exit but only for some functions and be able to access the original return value.

So I’m going to try to enhance my question. I would like to emulate really basic AOSD-like behavior. AOSD or Aspect oriented programming enables to add crosscutting concerns (debugging is a cross-cutting concern).

int main(int argc, char ** argv) {
  return foo(argc);
}

int foo(int arg_num) { 
   int result = arg_num > 3 ? arg_num : 42;
   return result;
}

int dbg(int returned) {
   printf("Return %d", returned);
}

I would like to be able to say, I’d like to trigger the dbg function after function foo has been executed. The problem is how to tell the compiler to modify the control flow and execute dbg. dbg should be executed between return and foo(argc) …

That’s really like __cyg_profile_function_exit but only in some cases (and the problem in __cyg_profile_function_exit is that you cannot easily see and modify the returned value).

  • 1 1 Answer
  • 2 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. Editorial Team
    Editorial Team
    2026-05-11T17:15:35+00:00Added an answer on May 11, 2026 at 5:15 pm

    If you still are interested in adding a GCC pass, you can start reading up GCC Wiki material just about that:

    • http://gcc.gnu.org/wiki/WritingANewPass and “Implementing Passes” from http://www.airs.com/dnovillo/200711-GCC-Internals/ on how to, well, add a pass.
    • The intermediate representation you are interested in is called GIMPLE. Some introduction is at http://www.airs.com/dnovillo/200711-GCC-Internals/200711-GCC-Internals-3-IR.pdf
    • Other information at http://gcc.gnu.org/wiki/GettingStarted
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anybody else noticed that Bindings with ElementName do not resolve correctly for MenuItem
Has anybody else had issues where Intellij 9 forgets what libraries you added to
I've editted a struct, added some members, removed others. But when I'm debugging, it
I have created a new iPhone project in Xcode 4 and added some files
Has anybody ever successfully written code to extract data from a SharePoint 2007 list
Has anybody written a plugin for outlook web access? Are there any resources to
has anybody done anything with scripts to parse an incoming e mail to a
Has anybody used Eclipse memory manager to detect memory leak in java codes? Can
Has anybody successfully integrated Clearcase with Teamcity (which advertises Clearcase support) to realize a
Has anybody used TreeMultimap in Google Collections? I understand that with a TreeMultimap, its

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.