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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:58:43+00:00 2026-06-02T19:58:43+00:00

I’m debugging a project that uses precompiled headers under GDB. While inspecting crash stack

  • 0

I’m debugging a project that uses precompiled headers under GDB. While inspecting crash stack trace, I found that GDB prints correct functions names but incorrect file and line number information.

Look at the following examples:

file.h

#ifndef FILE_H_
#define FILE_H
    #include "../precompiled_header.h"

    void func_A();
    void func_B();
#endif //FILE_H

Notice that there are only five lines in the header.

file.cpp

#include "file.h"

void func_A()
{
    int *a = 0;
    *a =0;
}
void func_B()
{
    func_A();
}

int main()
{
    func_B();

    return 0;
}

gdb program -> run -> bt: will print something like

....
func_A(): file.h at 32 <- incorrect file and line information
func_B(): file.h at 40 <- incorrect file and line information
main():   file.cpp at 14

As soon as I remove precompiled_header.h.gch, gdb prints

func_A(): file.cpp at 5  <- OK!
func_B(): file.cpp at 10 <- OK!
main():   file.cpp at 14

I’m sure that precompiled head and all the files are compiled with the same set of command line flags and that this precompiled header is really found and used(checked with -H option). No optimizations are turned on.

The program is compiled with

-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wno-unused -fexceptions -std=gnu++0x-fPIC -Winvalid-pch -Wdisabled-optimization -Wuninitialized -Wsequence-point -Winit-self

gcc -v gives the following output

Using built-in specs.

Target: x86_64-linux-gnu

Configured with: ../src/configure -v –with-pkgversion=’Ubuntu 4.4.3-4ubuntu5.1′ –with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs –enable-languages=c,c++,fortran,objc,obj-c++ –prefix=/usr –enable-shared –enable-multiarch –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.4 –program-suffix=-4.4 –enable-nls –enable-clocale=gnu –enable-libstdcxx-debug –enable-plugin –enable-objc-gc –disable-werror –with-arch-32=i486 –with-tune=generic –enable-checking=release –build=x86_64-linux-gnu –host=x86_64-linux- gnu –target=x86_64-linux-gnu

Thread model: posix

gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)

What could be wrong here?

  • 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-06-02T19:58:45+00:00Added an answer on June 2, 2026 at 7:58 pm

    This is a compiler bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44550

    It’s been fixed in g++ 4.5, so you should upgrade your compiler.

    Nevertheless, it’d be better to include your pre-compiled header as the first line of the cpp file instead of the h file, as the pre-compiled header inclusion needs to be at the top of the compilation unit. In your case, you would include it every time your include your header file. This change would stop that bug from affecting you.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.