Debugger error in Fortran

Hi,

I am having some problems with the debugger.

I open my f90 file, then set a breakpoint by clicking on the left side of the editor

(where the row numbers appear). Then I run a debugging session (using the icon in the tool bar).

The program does stop at my breakpoint but after a while dbx crashes with a segfault.

This happens quite randomly.

Sometime the crash is immediate, very often if happen after I have set some breakpoints

and made a few debugging operations.

I don't use the debugger in a weird way, I simply put a couple of breakpoints an let the

program run.

My machine mounts an Ubuntu 6.10 distribution with 2.6.17 kernel.

Any idea?

Thanks,

Lello.

Message was edited by:

lello1776

Message was edited by:

lello1776

Message was edited by:

lello1776

[888 byte] By [lello1776a] at [2007-11-26 22:58:25]
# 1

Which version of the debugger do you have? I don't have any experience running the debugger on Ubuntu, but at least it must not fail, that's for sure. Can you also post coredump stack of dbx here, please?

You can load core file into dbx itself with

$ dbx - core

and then issue "where -l" in dbx command prompt.

MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

I cannot get the core to be loaded into dbx.

If I use the dbx in console mode, I get a segfault every time I try to print a variable.

In particular i get:

dbx: internal error: signal SIGSEGV (no mapping at the fault address)

dbx's coredump will appear in /tmp

Aborted (core dumped)

However no core file in created in the /tmp directory, or in any other directory.

From console this happens every time I issue a command like: print variable_name

thanks

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Check your ulimit settings and make sure core file size is unlimited:

$ ulimit -c unlimited

$ ulimit -c

unlimited

And please provide version of dbx you're using (dbx -V output). It would also be of helpful to know what compiler (with what options) you were using to generate a.out.

MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

This is the dbx version I am currently using:

Sun Dbx Debugger 7.6 Linux_i386 Build40_1 2007/02/09

(it comes with the february express 4 built, that I have downloaded from the early access program)

I tried the ulimit command from the dbx console.

After ulimit -c unlimited I get a "bad ulimit", but after that it a try "ulimit -c" the result is "unlimited".

Still can't get any core information.

Message was edited by:

lello1776

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5
Please try setting ulimit from the shell and then run dbx (again, from the shell, no IDE). As I understand, its not hard to make it crash, right?And what about compilers? Did you use Sun Studio compilers to generate the code you're trying to debug?
MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

Hi,

I set the ulimit from bash and I finally got a core in the /tmp directory but I cannot load

it into dbx.

If I try

dbx my_executable_name /tmp/core

I get a coredump message again:

Reading molfc

dbx: internal error: signal SIGSEGV (no mapping at the fault address)

dbx's coredump will appear in /tmp

Aborted (core dumped)

I am currently using the sunf95 compiler

sunf95: Sun Fortran 95 8.3 Linux_i386 Build40_1 2007/02/09

The flags used are "-O0 -g"

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7
Actually, you should have specified dbx executable instead of my_executable_name in dbx my_executable_name /tmp/corePlease try dbx - /tmp/coreCan you try loading it into gdb and issuing 'bt' command there?
MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

Sorry, I don't understand.

What dbx excutable should I specify in the command line?

I run dbx on the executable file followed by the core file, as it should be:

dbx filename corefile

If I use your command from the console I get an error.

dbx -/tmp/core

dbx: unknown option letter: '/' in "/opt/sun/sunstudio12/bin/dbx"

dbx: unknown option letter: 't' in "/opt/sun/sunstudio12/bin/dbx"

dbx: unknown option letter: 'm' in "/opt/sun/sunstudio12/bin/dbx"

dbx: unknown option letter: 'p' in "/opt/sun/sunstudio12/bin/dbx"

dbx: unknown option letter: '/' in "/opt/sun/sunstudio12/bin/dbx"

If I try to load it into gdb I get the same (core dumped) error.

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 9

The core dump is produced by dbx, not the program you were debugging. In order to debug core file, you need to supply name of the executable that produced this core file, which is dbx. It is often possible for dbx to extract executable name from core file itself, so it can be omitted and replaced with dash.

Please add a space after "-" and see if it works.

> If I try to load it into gdb I get the same (core dumped) error.

Well, looks like smth's totally wrong with your system even if (presumably, stable version of) gdb doesn't work... Anyway, let's see dbx call stack at time of crash, maybe we will find a clue.

MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 10

No. It does not work, even if I put a dash.

The same core dumped error happens if I use dbx instead of my_executable.

Ths problem occurs only with this particular program I am debugging.

If I create a small f90 file and debug it then dbx works fine.

How can I check th dbx call stack?

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 11

Ok, I used gdb and this time it worked, or at list gave something different from an error.

gdb - /tmp/core

(no debugging symbols found)

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

Core was generated by `/opt/sun/sunstudio12/bin/dbx ./bin/molfc'.

Program terminated with signal 6, Aborted.

#0 0xffffe410 in __kernel_vsyscall ()

(gdb) bt

#0 0xffffe410 in __kernel_vsyscall ()

#1 0xb7d01770 in ? ()

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 12
Well, stack trace doesn't show any dbx code, so I can't make a reasonable guess.But I can make a wild guess: maybe crash happens because of some library, which is not linked with a simple f90 program that you're able to debug?
MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 13

No, all the libraries are compiled with sunf95 with the -g option.

Another weird thing is that if I set a break point into a subroutine and I try

to print some variable then I get no error.

The error occurs only if I try to get some variable value from the main.

Message was edited by:

lello1776

lello1776a at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 14

Then its probably about debug information... Can you post your Fortran code here or send it to kms at sun dot com so that I can reproduce the problem and file a bug? You can also file a bug yourself through bugs.sun.com. Although Ubuntu is officially unsupported, the bug might be independent from platform of execution; well, even if it is, it worth fixing anyway.

MaximKartasheva at 2007-7-10 12:24:16 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 15
The code is really long, it is about 10000 lines without the libraries, which includesblas, lapack, arpack, slatec, and an xml parser. It is split acrossseveral directories,it's kind of a medium size project. How can I upload it?
lello1776a at 2007-7-21 19:19:41 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 16
Can you create smaller test case which shows the same problem?
MaximKartasheva at 2007-7-21 19:19:41 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 17
I'll try...but it is really hard.I'll post it when I'll be ready.Thanks,Lello.
lello1776a at 2007-7-21 19:19:41 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 18
Okay, thank you!
MaximKartasheva at 2007-7-21 19:19:41 > top of Java-index,Development Tools,Solaris and Linux Development Tools...