Re: [Anjuta-list] Basic problems with Anjuta



Bonjour Sebastien,

---- "Sébastien Granjoux" <seb sfo free fr> wrote: 
> Hi Steve,


> > So I select Debug->Run Target, select "Run in terminal" and "stop at the beginning". main.c opens
> > (after selecting an editor) highlighs the get_set_locale() line with a yellow arrow next to a bolded
> > line number (52) in the margin. I hit F5 to step into the function but we step over the function to the
> > gtk_init line. The highlighting, arrow and bolding step down one line. Presumably, we do not step into
> > gtk_set_locale() because Anjuta doesn't know where to find the source file? No advisory messages?
> 
> I think it is a common behavior. F5 steps into a function only if gdb 
> get debugging information about it, which is normally not the case for 
> common libraries functions. It's not only the source file which is 
> missing, but the information about the link between a particular place 
> in the code and the source files. If you really want it is possible to 
> get debugging information by recompiling the corresponding library with 
> debugging informations.
> 
> There is no message about this. I think that most of the time you don't 
> want to dig into such function. I don't remember if other debugger gives 
> such message. I don't think it is possible to do it with gdb.

I have seen debuggers that display assembly code when there is no source code or symbol information to display. Anjuta's behaviour is OK as long as we know what it is going to do and it always does the same thing.

> > Now we get to the main problem. I hit F5 again and the app window appears, the yellow arrow and highlighting
> > dissappear and the bolding moves to line 50, ie up 3 lines to a blank line. I read a couple of days ago that
> > someone else was having problems where the debugger was not following the source code because of optimization.
> > I looked in the Makefiles and changed -O2 to -O0, rebuilt and tried again but I get the same problems.
> 
> Yes. Instead of changing the Makefile, it's better to change the 
> Makefile.am file or run ./configure 'CFLAG=-g -O0' instead because 
> autotools can recreate the Makefile from Makefile.am. That's fine for 
> just a test though.
> 
> > I've tried this exercise several times and sometimes the yellow arrow and highlighting don't appear at all.
>  > The one thing that does alwasy happen is that the debugger does not 
> stop when stepping into the gtk_init line.
>  > It appears to run on into the gtk_main loop.
> 
> I'm not sure you can step into gtk_init function. I think a easier way 
> to stop the debugger is to put breakpoint into your program.

It would be OK if Anjuta just stepped over the gtk_init() to the next line just as it stepped over gtk_set_locale() but it didn't. It appears to have executed a Continue command and run the program to the end which in this case is an infinite loop.
 
> > Am I missing some vital step here? Do I have something mis-configured?
> 
> I don't think you missed something here. I think that you rather try to 
> do things those are not possible now or run into bugs in the debugger 
> plugin. If your program is small enough, perhaps you can attach to a bug 
> report and tell me exactly what you do (press this key, click on this 
> button...). I will try to do the same and tell you if it is a bug or not.

I didn't actually write any code yet. Everything can be repeated from inside Anjuta. I have a directory called junk2 where I have been testing this. See if you can reproduce this:

junk2> rm -rf * .*
rm: cannot remove directory `.'
rm: cannot remove directory `..'
junk2> ls -al
total 16
drwxrwxr-x 2 sblackwell sblackwell 4096 2008-11-07 15:57 .
drwxrwxr-x 7 sblackwell sblackwell 4096 2008-11-06 11:35 ..
junk2> anjuta -n -f
Anjuta starts up with a list of files in the left hand pane and nothing in the right hand pane. 
Debug is available in the menu. Why is this? Since I used the -n flag I was expecting Anjuta to start as if it was being run for the first time.

>From the File menu, select New and then Project. 
The "Application Assistent" is started. (Note the typo - that should be Assistant)

Select Forward. The Project Type window is displayed with the 'C' tab visible.

Select GTK+ and click Forward. The Basic Information window is displayed.

Change the Project Name to 'junk' and click Forward. The Project Option page is displayed.

Change the Destnation to the junk2 directory, select 'No license' and turn off "Add internationalization' then click Forward. The Summary page is displayed.

Click Apply. Messages pass by as the Project is being configured. The window title changes to 'Anhuta - junk2', the Debug option is removed from the menu and the list of files in the left hand pane changes to those under the junk2 directory.

>From the Build menu, select 'Run Configure...'. The 'Configure Parameters' pop up diaglog is displayed.

Enter 'CFLAGS=-g -O0' and click OK. The Configure script runs with no errors.

In the left hand pane, double click on  editorMakefile. The 'Select a plugin' dialog appears.

Select 'GtkSourceView editor' and click OK. The Makefile appears in the right hand pane.

Check that CFLAGS is set to -g -O0. Good, it is. Repeat the check for src/Makefile. OK.

>From the Build menu, select 'Build Project'. Project builds, no errors.

>From the Edit menu, select Preferences, select the Installed plugins tab and click on Debugger and then Close. Debug appears in the menu. 

>From the Debug menu, select 'Run Target...'. The Program Parameters dialog appears with the Debugger Target already filled in.

Check the "Run in Terminal' and 'Stop at Beginning'  boxex and click Execute. The file main.c appears in the right hand pane with the cursor at line 52, set_gtk_locale(). This time there is no yellow highlighting or yellow arrow in the margin. The left hand pane changes to show the registers.

Press F6. The cursor moves to line 53, gtk_init()

Press F6. The cursor disappears, application window appears and the mouse poiunter changes to show busy. The program controls in the Debug menu are greyed out apart from 'Stop Debugger'

Select 'Stop Debugger'. A confirmation dialog appears. 

Select Yes. The left hand pane changes to show local symbols. A terminal with a yellow backgraound appears at the bottom.

Select File->Close Project. The left and right panes are cleared but the window title still shows 
Anjuta - <path>/junk2/src/main.c

Select File->Quit. Anjuta closes.

Restart Anjuta. Anjuta starts as before. Debug is in the menu.

Select File->Open recent->junk.anjuta. The junk project opens with the left pane showing local symbols, the right pane showing main.c and no bottom pane. Debug is removed from the menu.

Go through the process of enabling the Debug plugin and re-run the program as before with the same options. This time the yellow highlighting is shown and there is a yellow arrow in the margin. Stepping through still fails after the second step as before.

Thanks,
Steve.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]