debug user routine (*.f / *.for) with external debugger software?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

debug user routine (*.f / *.for) with external debugger software?

Brian Bak
Hi

I would like to have a external debugger to debug my user routine of a user
element (UEL). I have found a tutorial describing how to setup intel (R)
debugger with abaqus http://www.ichec.ie/support/tutorials/abaqusdebug.pdf (
*only 4 pages*)
The description takes basis in a UNIX type system and maybe because of this
I am not able to get it to work on my windows system.
More precisely I get and syntax error at the line:
"for option in varOptions[:]"
which is some of the code that should be added to the environment file
abaqus_6v.env in order to do external debugging.

Is it possible to use microsoft visual studio 2008 as debugger and if it is
possible how to I attach the compiled file in VS in a similar manor to the
way it is done with intel (R) debugger in the Tutorial?

If you have another way of doing something similar and a description on how
to do it this will also be very much appreciated.

Thanks in advance

Regards Brian

Brian Bak


[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: debug user routine (*.f / *.for) with external debugger software?

who.is.mailing.me
Hi Brian,

> I would like to have a external debugger to debug my user routine
> of a user element (UEL).
> Is it possible to use microsoft visual studio 2008 as debugger and
> if it is possible how to I attach the compiled file in VS in a
> similar manor to the way it is done with intel (R) debugger in the
> Tutorial?

In older versions (6.4-), it was possible to use
abaqus -j myJob -user mySubroutine -debug -standard <debugger_name>" in the command line (note the absence of = and the use of - for the arguments. Also, the debugger must be in the PATH, otherwise the command line interpreter won't find it). This was actually the official way to debug things, but I am not sure if it still works.


Alternatively, if you google for '"abaqus" command line debug' (note the quotes for abaqus), you will find several pages that detail procedures to do it. You need to have VS open, and a breakpoint set in your UEL file (the beginning is usually the most useful). Set the necessary debug flags in the compile_fortran and link_sl lines of abaqus_v6.env before doing anything else (the best is to have a local abaqus_v6.env in the directory containing the *.inp and *.f files). One procedure involves putting a read statement in the source, so that you can attach the debugger.

If you succeed in using VS to debug your code, please post a follow-up message with detailed instructions, it will benefit everyone!

Hope this helps,
Fernando


Reply | Threaded
Open this post in threaded view
|

Re: debug user routine (*.f / *.for) with external debugger software?

vikas_hcl2001
Brian, Fernando, and others:

I use VS for debugging. I am copying the following from a webpage where I posted it recently:

1. Prepare the Abaqus environment
a. Go to C:\Abaqus\6.9-1\site and open abaqus_v6.env with a text editor
b. Scroll down
c. In "compile_fortran", add `/Od' and `/Zi' parameters to enable Intel Fortran compiler to add debug symbolic information into .obj file
• compile_fortran=['ifort', '/c', '/Gm', '/recursive', '/nologo', '/heap-arrays:1', '/include:%I', '/Od', '/Zi']
d. In "link_sl", add /DEBUG to let Visual C++ .NET linker to link the files with the symbolic information in .obj file
• link_sl='cmd /c "LINK /DEBUG /nologo /INCREMENTAL:NO /subsystem:console /machine:X86
e. In "link_exe", add /DEBUG to let Visual C++ .NET linker to debug the files
• link_exe='cmd /c "LINK /DEBUG /nologo /INCREMENTAL:NO /subsystem:console

2. Prepare your job file (*.inp) and the subroutine file (*.for)
3. Open your FORTRAN code in Microsoft Visual Studio.
4. Insert a READ(*,*) VARIABLE in your subroutine source code file right after the "DIMENSION" definition where "VARIABLE" is the arbitrary name of the variable. Also, insert a breakpoint at a function/variable of interest like at READ(*,*), VARIABLE or watch a variable of interest (using Debug -> QuickWatch). You can add/remove breakpoints by pressing F9.

Code:
c*******************************************************
      INCLUDE 'ABA_PARAM.INC'
C
      CHARACTER*80 CMNAME
C
C
      DIMENSION STRESS(NTENS),STATEV(NSTATV),
     1 DDSDDE(NTENS,NTENS),DDSDDT(NTENS),DRPLDE(NTENS),
     2 STRAN(NTENS),DSTRAN(NTENS),TIME(2),PREDEF(1),DPRED(1),
     3 PROPS(NPROPS),COORDS(3),DROT(3,3),DFGRD0(3,3),DFGRD1(3,3)
C    
C
C
      PARAMETER (M=3,N=3,ID=3,ZERO=0.D0,ONE=1.D0,TWO=2.D0,THREE=3.D0,
     +          SIX=6.D0, NINE=9.D0, TOLER=0.D-6)
C
      DIMENSION DSTRESS(4)      
C      
      DIMENSION VARIABLE(1)
      READ(*,*), VARIABLE
c*******************************************************

5. Launch ABAQUS with the command "ABAQUS job=JOB_NAME user=SUBROUTINE_NAME interactive
a. ABAQUS command prompt will wait when it reaches "READ(*,*) as defined in step 4.
6. Watch the command prompt window. As soon as the command prompt says <N tokens out of M licenses remain available> a couple of times, switch to the Visual Studio window.
7. Go to Tools -> Attach to Process. Select standard.exe and click Attach.
8. In the command prompt window, type in some arbitrary value (for "READ(*,*) in step 4.)
9. Visual Studio should show you the source code in another tab after it successfully breaks in the subroutine you are trying to debug.
10. Debug as you wish. For example, start pressing F11. (Visual Studio may switch back to the command prompt window if you also define a breakpoint at Read(*,*), VARIABLE)


Happy coding/debugging!


Vikas


--- In [hidden email], "fcn_public" <who.is.mailing.me@...> wrote:

>
> Hi Brian,
>
> > I would like to have a external debugger to debug my user routine
> > of a user element (UEL).
> > Is it possible to use microsoft visual studio 2008 as debugger and
> > if it is possible how to I attach the compiled file in VS in a
> > similar manor to the way it is done with intel (R) debugger in the
> > Tutorial?
>
> In older versions (6.4-), it was possible to use
> abaqus -j myJob -user mySubroutine -debug -standard <debugger_name>" in the command line (note the absence of = and the use of - for the arguments. Also, the debugger must be in the PATH, otherwise the command line interpreter won't find it). This was actually the official way to debug things, but I am not sure if it still works.
>
>
> Alternatively, if you google for '"abaqus" command line debug' (note the quotes for abaqus), you will find several pages that detail procedures to do it. You need to have VS open, and a breakpoint set in your UEL file (the beginning is usually the most useful). Set the necessary debug flags in the compile_fortran and link_sl lines of abaqus_v6.env before doing anything else (the best is to have a local abaqus_v6.env in the directory containing the *.inp and *.f files). One procedure involves putting a read statement in the source, so that you can attach the debugger.
>
> If you succeed in using VS to debug your code, please post a follow-up message with detailed instructions, it will benefit everyone!
>
> Hope this helps,
> Fernando
>


Reply | Threaded
Open this post in threaded view
|

Re: debug user routine (*.f / *.for) with external debugger software?

ale.o
Dear all,

I am using Abaqus 2018 and I am looking for something similar to
abaqus_v6.env file. I didn't find any .env file and I'm having trouble
following your instructions. Do you have any suggestion?  

Thank you

Alessandra




--
Sent from: http://abaqus-users.1086179.n5.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: debug user routine (*.f / *.for) with external debugger software?

cpmorena
Reply | Threaded
Open this post in threaded view
|

Re: debug user routine (*.f / *.for) with external debugger software?

ale.o
Thank you. I finally found the following path in ABAQUS 2018:
 

 C:\Program Files\Dassault Systemes\SimulationServices\V6R2018x\win_b64\SMA\site