Re: how to debug IDL with call_external? [message #18380] |
Mon, 03 January 2000 00:00 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Nando <f.iavarone@acsys.it> writes:
> pei zeng wrote:
>
>> I have an IDL application which calls a FORTRAN code(quite large). When I
>> run it, it crashed the application and would not allow me to debug the
>> fortran code.
>
> Have you tried to use a debugger?
> I work with call_external of C code and I use dbx for debugging.
> I run the dbx after IDL launching (on the process id of IDL).
> After your code has linked the shared object, set a break point on your
> external code and
> it is possible to trace the execution.
In developing XFILTER, a devious add-on to IDL, I did a lot of
debugging. I found that using the debugger worked fine and I could
set breakpoints within my own code. In my case I used GDB on C code
but any debugger that normally works should be okay for you. However,
there are a few gotchas:
* of course, you need to compile with debugging support.
* you should be careful to debug the binary executable and not the
script which is normally run. Usually this means that you have to
set a few environment variables that the script would normally set,
and then run the debugger on $IDL_DIR/bin/bin.arch/idl where arch
is your architecture.
* there is a chicken/egg problem regarding loaded programs. The
debugger won't know about your program until the object file is
loaded; BUT you can't load your program without first running IDL.
Therefore you can't immediately set a breakpoint on your first run.
Usually I get around this by having a "dummy" function which does
nothing. By CALL_EXTERNALing this dummy function, the object file
is forced to be loaded. After that you can pop back to the
debugger and set breakpoints within your code.
Good luck,
Craig
P.S. XFILTER is a graphics driver for Unix versions of IDL which
saves entire graphics streams for subsequent playback. Equivalent to
David's XWINDOW but much more straightforward. Find it here:
http://cow.physics.wisc.edu/~craigm/idl/idl.html (look for XFWINDOW)
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: how to debug IDL with call_external? [message #18383 is a reply to message #18380] |
Mon, 03 January 2000 00:00  |
Nando Iavarone
Messages: 48 Registered: December 1998
|
Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
pei zeng wrote:
<blockquote TYPE=CITE>I have an IDL application which calls a FORTRAN code(quite
large). When I
<br>run it, it crashed the application and would not allow me to debug
the
<br>fortran code.</blockquote>
Have you tried to use a debugger?
<br>I work with call_external of C code and I use dbx for debugging.
<br>I run the dbx after IDL launching (on the process id of IDL).
<br>After your code has linked the shared object, set a break point on
your external code and
<br>it is possible to trace the execution.
<p>Cheers,
<br> Nando
<pre>--
Nando Iavarone
Advanced Computer System - SPACE DIVISION
via Lazzaro Belli, 23
00040 Frascati - RM
Tel: +39-6-944091 (switchboard)
9440968 (direct)
E-mail:
f.iavarone@acsys.it
FrdndVrn@altavista.net</pre>
</html>
|
|
|
Re: how to debug IDL with call_external? [message #18388 is a reply to message #18380] |
Thu, 30 December 1999 00:00  |
Andy Loughe
Messages: 174 Registered: November 1995
|
Senior Member |
|
|
pei zeng wrote:
>
> Hello, everyone!
>
> Happy new year!
>
> I have an IDL application which calls a FORTRAN code(quite large). When I
> run it, it crashed the application and would not allow me to debug the
> fortran code. Does anybody know to solve this problem? I am running both on
> NT and SUN.
>
> Thanks!
>
> pei
The FORTRAN code runs fine in stand-alone mode?
Does it have any print*, or write(6,*) statements?
These may be causing the problem.
--
| Andrew F. Loughe | email: afl@cdc.noaa.gov
| NOAA-CIRES CDC | web : www.cdc.noaa.gov/~afl
| 325 Broadway Mail Code R/E/CD1 | voice: (303)497-6211
| Boulder, CO 80303-3328 | fax : (303)497-7013
------------------------------------------------------------ -----
"We must believe in free will, we have no choice"-Isaac B. Singer
|
|
|