views:

35

answers:

2

Hello!!

First of all... this is my message #1 in this place, so... please be nice with me ;)

I just started recently to study Gnome apps/libraries and I found that debuggers are an excellent way to learn, because seeing the code running helps a lot in understanding the structure of the program.

But I have a problem. For example, debugging gnome-panel I found a lot of calls to external functions (basically the GTK+ functions), and although pretending to see all the code of all the functions applications like this call would be crazy, there are a lot that will be very interesting to see in action. The problem is that the debugger hasn't the code of those libraries loaded and it can't show it to me —at most it shows the line number where the execution is.

I'm using Nemiver and when it tries to enter in an external function it claims because it can't find a file it supposed to be somewhere. For example, trying to enter in gtk_window_set_default_icon_name it tries to load /build/buildd/gtk+2.0-2.16.1/gtk/gtkwindow.c, and calling XSetIOErrorHandler, ../../src/ErrHndlr.c.

So now I think that I'm doing something wrong... Why Nevimer are looking for those source files in those places??

My system does not even have the /build/buildd/ folders... and I don't know if I'm doing something wrong or I need to install somethig or what.

Any suggestion? How do you debug this kind of applications?

Best regards and thanks a lot for your time —and forgive me if my English is bad.

A: 

A debugger executes the lines in source file which when compiled (with debugging symbols enabled) generate the binary. In case of external libraries, they are shipped as separate entites(object files) and linked with the current code to produce the executable.

If the debugger could iterate over the source files, one would have generated source files corresponding to a library and that would break many professional contracts.So, I am not sure if it is possible.

However, the GTK library you are talking about is opensource and the API calls are documented here. So, IMO it is better and much time saving to know what a particular function call to a library does, and go along with rest of your code.

Neeraj
A: 

Well... The question was more simply than I thought.

Because Nemiver was trying to access some inexistent folders I thought that creating them would be an option, and it was xDDDDD.

Nemiver has an option to load source files in File -> Open source file [I really don't know if that's exactly the name of the option because I'm seeing the program in Spanish] and when you select it a dialog is open and one of it's two main options is to select from where you want to look for your source file: From the executable file or from your filesystem... I selected from the executable and there I saw the strange paths starting with /build. Then I assume that the executable knows about where was the source files that were used to build it...

Well, summarizing: I've satisfied the Nemiver assumptions about the sources paths and now everything are working automatically.

For example: Since Nemiver was telling me that the GTK+ files were in /build/buildd/gtk+2.0-2.16.1/gtk/ I've created /build/buildd and I've downloaded gtk+ (2.16.1). Then I've decompressed it in buildd with the name gtk+2.0-2.16.1 and now when I try to enter in a GTK+ function, Nemiver automatically loads the correspondent file and shows me it's execution step by step :)

Sanva