Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

578 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