Topic: Beginner Help with Debugger

I have not been able to step through an old FORTAN project with the debugger included with Simply Fortran.   

I used to run the code in Compaq Visual Fortran on a 32-bit machine with Windows XP.  When I would debug the project in CVF I could set break points in the FORTRAN code, step through the code and see the results in the console from each line of code. 

In Simply Fortran I can build and run the project successfully.  However, I can't get the debuggger to step through the lines of FORTRAN code.  When I click the debug icon a "Souce Window" opens and I see what I think is assembly language.  For example:

0x40dced <main+4>:      sub     $0x20,%rsp

I can step through these lines with the debugger but the code doesn't mean anything to me.  I've tried to change from ASSEMBLY to SOURCE in the pull down menu on the right hand side with no luck.  Is there a simple fix to this problem or a resouce to help me learn to use the debugger?

Thanks,

--Dean

2 (edited by JohnWasilewski 2012-08-21 19:37:01)

Re: Beginner Help with Debugger

I'd never used a debugger before until Jeff got me started with this one but I use it all the time now.

1. Compile/ link with the debug option (obviously).

2. Click 'Debug Project'.

3. Of the two pull-down gadgets, pull down the one on the left.
4. Select a source file name.
5. Scroll to where you want a breakpoint (or several)
    (only available on lines with a small '-' in the LH margin)
6. Click the line no. to set a breakpoint.
7. Repeat 5. and 6. as many times as you need.

8. Repeat 3. to 7. for as many breakpoints as you need.

9. Click the running bloke icon
10. Press C to continue.

Your program will now either run as far as and stop on the first breakpoint or possibly crash before it gets there if there's anything wrong with it before that.

11. Press C to continue to the next breakpoint
          or S to execute the next line (stepping into subroutines)
          or N to execute the next line (incl executing any subroutine call)

12. Press P to get it to make you a cappuccino
          or L for a cafe latte

13. $ pays money into your account.
13. F seems not to be implemented yet, alas.
---

Once you can do all this, you can quickly discover more about debugger facilities, like reading or displaying variables and array variables.

Have fun.
---
John

Re: Beginner Help with Debugger

Dean,

It sounds like debugging might not be enabled in your compiler options.  Open the Compiler Options dialog by selecting "Compiler..." from the Options menu.  Make sure "Enable Debugging" has been selected.  Finally, exit out of the options dialog, perform a "Clean" from the Build menu, then rebuild the project.

When you click the Debug icon on the toolbar this time, the source window should show Fortran code and allow you to step through it.

The Insight debugger does take some getting used to.  It was not designed for just Fortran, so sometimes it can be confusing.

Let us know if you have better luck!

Jeff Armstrong
Approximatrix, LLC

Re: Beginner Help with Debugger

John, the pull down menu on the left does not contain my source files. For example main.for is not there.  Could the debugger be looking in the wrong location?  Or could I be missing the debug option?

Also, how do I tell it to make my cappucino a double?

Re: Beginner Help with Debugger

Thanks Jeff, after enabling the Debugger and performing a clean I can now debug.  Thanks for the help. 

--Dean

Re: Beginner Help with Debugger

I just started to evaluate SF and had trouble stepping through source code.  So this thread was very helpful!  Thanks!

7 (edited by JohnWasilewski 2012-08-21 20:01:27)

Re: Beginner Help with Debugger

Would anyone care to draft a page of very clear beginners' instructions on the debugger, to invite Jeff to include in the HELP file?

The page of info that I posted a few weeks ago might be a start, but it would be better for it to be amplified and/or corrected first by someone else who has also had difficulty getting started with it, to give the maximum help to users who are new to debugging.

Jeff might perhaps consider including a single page in the main SF HELP file which begins by explaining what the debugger is and where (with a link) to find comprehensive help on it but then following on the same page with some very simple get-you-started advice - because the on-line help on the debugger is not at all easy to navigate around and assimilate for new and inexperienced debugger users.
---
John

Re: Beginner Help with Debugger

I think a beginner's guide to debugging would be quite helpful, but I just haven't gotten around to authoring one myself.  Version 1.32, which should be released early next week, fixes some of Insight's weirdness.  Specifically, it gets rid of the odd "main" procedure requirement at startup, properly alphabetizes the file list, and updates the support code for the 32-bit debugger.  Furthermore, debugging is now enabled by default during install, and the user is explicitly warned if debugging is requested on a project where it has been disabled.  Hopefully people will find the changes useful.

Jeff Armstrong
Approximatrix, LLC