GDB refuseing to step into method from static library

Posted on 2005-04-03
Medium Priority
Last Modified: 2008-01-09
I am haveing dificulty stepping into a class method belonging to a static library for which my code httpget.cpp is linked.  I am useing the gdb/insight debugger in a WinXP enviroment, where my compiler is MINGW (g++ 3.3.1 mingw-special)

In the code below, I wish to step into the constructor for Parse, which resides in the static library for which I linked against.  When I atempt to step into Parse, gdb lands inside HttpGetSocket.h which it should not.  Instead It should step into Parse.cpp:66

The source for the static library exists inside a seperate directory from which httpget.cpp exists.  The library was compiled with -g3 option, just the same I compiled httpget.cpp with -g3

Here is httpget.cpp

#include <HttpGetSocket.h>
#include <HttpsGetSocket.h>
#include <SocketHandler.h>
#include <Parse.h>

bool Get(const std::string& url_in)
      std::string sDelim = "://";
      Parse pa(url_in, sDelim);  // I want to step into this
      std::string protocol = pa.getword();
      std::string host = pa.getword();
      int port;
            Parse pa(host,":");
            port = pa.getvalue();
      std::string url = "/" + pa.getrest();
      std::string file;
            Parse pa(url,"/");
            std::string tmp = pa.getword();
            while (tmp.size())
                  file = tmp;
                  tmp = pa.getword();
      SocketHandler h;
      if (!strcasecmp(protocol.c_str(),"http"))
            HttpGetSocket s(h,host,port ? port : 80,url,file);
            while (h.GetCount())
            return s.Complete();
            printf("Unknown protocol: '%s'\n",protocol.c_str());
      return false;

int main(int argc,char *argv[])
       std::string sArgv = argv[1];
      for (int i = 1; i < argc; i++)
            if (!Get(sArgv))
                  printf("Failed: %s\n",argv[i]);

When i issue step on the line Parse pa(url_in, sDelim); I reach HttpGetSocket.h:44 but I should reach Parse.cpp:66 , Aditionaly, gdb remains stuck on line 44 for two dozen next commands untill it finaly returns to Get, without ever reaching Parse constructor.

I need a solution that will get me into the code for Parse.cpp:66 so that I can continue debugging.

Question by:cntfind80
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 39

Accepted Solution

itsmeandnobodyelse earned 1000 total points
ID: 13697197
It seems that your Debug databases are not up-to-date. Reinstalling MINGW (latest version) should solve the problem.

You also could try to include a copy of parse.h and parse.cpp (in project source directory) to your project, thus getting refreshed debug information. However, you might get linking problems when doing that.

Regards, Alex

Author Comment

ID: 13699963
I got the new version 3.4.2 of mingw special,
GNU gdb 2003-09-20-cvs (cygwin-special),

Moved the library source into the directory containing httpget.cpp and rebuilt first the static library, then rebuilt httpget.cpp And it worked, I can now step into Parse.cpp:66 as well as step into other things I was previously haveing trubles jumping into.

Many thanks

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question