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 6852459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:23+00:00 2026-05-27T01:22:23+00:00

I am using GCC to build my embedded C application, that I debug with

  • 0

I am using GCC to build my embedded C application, that I debug with GDB. The app consists on a program running on a host processor and multiple programs running on multiple accelerator DSP cores.

My host (control) program has a very simple main function with a short loop calling a bigger function that does some stuff and activates the accelerators. My problem is that when compiling with optimization, the debug is harder in terms of breakpoint location in the main function. When building w/o optimization, the other function compiles sub-optimally.

A possible solution would be to separate the host project to two source files and use different level of optimization. However, I would like to keep it in the same file.

Is there a way (pragma?) to instruct the compiler to do different level of optimization in the same source unit?

  • 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. Editorial Team
    Editorial Team
    2026-05-27T01:22:24+00:00Added an answer on May 27, 2026 at 1:22 am

    With a recent GCC (e.g. GCC 4.6), you can change optimization with function specific option pragmas, like e.g.

     #pragma GCC optimize ("-02")
    

    You can also have function attributes for the same.

    IIRC, this appeared in GCC 4.5, and works much better in 4.6, so you need a recent version of GCC.

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

Sidebar

Related Questions

I have an application which i build using gcc on linux host for ARM
I want to compile an application with debug information using gcc and gdb. When
How to build Sandboxed app without XCode? I mean I'm using gcc Make to
How do I build executables using GCC so that it is not possible to
The following little program is very awkward using GCC version 4.2.1 (Apple Inc. build
I'm using GCC to generate a dependency file, but my build rules put the
I'm trying to build python 2.5.2 on Solaris 8 using gcc 3.4.2. I can't
I am using GCC precompiled headers in my project with multi-architecture build, but things
I'm using GCC on Windows 7 (using the TDM's build). I installed MSYS to be
We have a c++ application which I recently ported from Linux/gcc to build on

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.