Interpreting the memory address in fortran 90 - fortran90

Is there any way to interpret the hex address directly/indirectly in fortran(90). For instance, some times I get memory segmentation issue followed by Failing at address: 0x1fffffff8. A more complete message is something like this:
[amir-desktop] *** Process received signal ***
[amir-desktop] Signal: Segmentation fault (11)
[amir-desktop] Signal code: Address not mapped (1)
[amir-desktop] Failing at address: 0x1fffffff8
[amir-desktop] [ 0] /lib/libpthread.so.0(+0xf8f0) [0x2af5efcb08f0]
[amir-desktop] [ 1] test.exe(__box_mod_MOD_constructlist+0x35c) [0x44052c]
[amir-desktop] [ 2] test.exe(__box_mod_MOD_box_move+0x72) [0x443372]
[amir-desktop] [ 3] test.exe() [0x44c81b]
[amir-desktop] [ 4] test.exe(main+0x1d) [0x41336d]
[amir-desktop] [ 5] /lib/libc.so.6(__libc_start_main+0xfd) [0x2af5f59a9c8d]
[amir-desktop] [ 6] test.exe() [0x41391d]
Is it possible to realize that this address is related to a specific variable, maybe by a simple print statement. I know that loc function prints an integer regarding the address of the variable (Another question arise if they are convertible to hex type address). I would guess that it might be possible to use debugger for that purpose. I would appreciate if some one can comment on this (and some suggestion) as well.
I am currently using gfortran 4.6. under linux distribution.
Thanks

This line:
[amir-desktop] [ 1] test.exe(__box_mod_MOD_constructlist+0x35c) [0x44052c]
tells you that the error was in the function constructlist in the box_mod module. I would start looking there for any obvious errors first.
Try compiling with the following flags:
gfortran -g -fbacktrace -fbounds-check -Wall test.f90
These will (in order): turn on debugging symbols, print out backtraces, check array bounds and print most warnings about unsafe code during compilation.
If that still doesn't solve your problem, you can use gdb on a core dump. This is a record of the state of your program when it crashed. You'll need to enable core dumps first by running ulimit -c unlimited in your terminal. Next, run your code - you should get an error like Segmentation fault (core dumped) - and it will create a file named core or core.pid, where pid is a number. Finally, you can run gdb like so:
gdb ./test.exe core.pid
It will print a whole bunch of information and then leave you with a (gdb) prompt. Run a stack trace with bt to see what happened when your program crashed. quit will exit gdb.

Related

Install CLAPACK-3.2.1 in fedora 23

Hi I use fedora23 to calculate matrix.
So I am trying to install CLAPACK-3.2.1 to my computer.
In the procedure,
1. download clapack.tgz (version 3.2.1) from www.netlib.org/clapack -> done
2. cd CLAPACK-3.2.1 and cp make.inc.example make.inc -> done
3. make f2clib -> done properly
4. make blaslib -> done properly
5. make (this takes a while) -> problem starts here.
in a procedure of make, there are two errors. The error message is this.
make[2]: Leaving directory '/home/optics/CLAPACK/TESTING/EIG'
NEP: Testing Nonsymmetric Eigenvalue Problem routines
./xeigtstz < nep.in > znep.out 2>&1
/bin/sh: line 1: 9412 Segmentation fault (core dumped) ./xeigtstz < nep.in > znep.out 2>&1
Makefile:438: recipe for target 'znep.out' failed
make[1]: *** [znep.out] Error 139
make[1]: Leaving directory '/home/optics/CLAPACK/TESTING'
Makefile:44: recipe for target 'lapack_testing' failed
make: *** [lapack_testing] Error 2
==============================================================================
I cannot understand this. Please help me dealing with these errors.
I have also encountered this problem and was able to resolve it by increasing the stack size using ulimit as suggested here. The following worked for me:
$ sudo ulimit -s 100000
Followed by running make as usual. If you would like a primer on what this command does, check out this question: What does “ulimit -s unlimited” do?. Basically, it increases the limits on the scratch space in memory allocated to a thread.
In Kubuntu 17.10 it worked in this way:
ulimit -s unlimited

SIGSEGV on memory access in Beaglebone Black (ARM) cross-compilation w/ Eclipse - Linaro

I am new to this, or better rusted (being 62).
Trying to develop on Beaglebone Black running Debian over IP using Eclipse Luna CDT and linaro tools.
I succeed in running and debugging standard helloworld.c.
Need to control GPIO fast (to connect to uncommon peripheral) but
all attempts to read or write to memory mapped registers fail.
Instruction
i = (*((volatile unsigned int *)(0x4804c130)))
which should read GPIO status register results in
Child terminated with signal = 0xb (SIGSEGV)
GDBserver exiting
logout
This is the source (hellobone.c) I compile without errors:
int main(void)
{
unsigned int i = 1;
i = (*((volatile unsigned int *)(0x4804c130))) ;
}
(I tried all variations on this pointer arithmetic)
Makefile trace: (ignore includes)
---COMPILE--- C:/hellobone/source/hellobone.c
"C:\gcc-linaro\bin\arm-linux-gnueabihf-gcc.exe" -c -o C:/hellobone/object/hellobone.o C:/hellobone/source/hellobone.c -marm -O0 -g -I. -IC:/hellobone/include
.
---LINK---
"C:\gcc-linaro\bin\arm-linux-gnueabihf-gcc.exe" -o hellobone C:/hellobone/object/hellobone.o C:/hellobone/object/tools.o C:/hellobone/object/gpio_v2.o -marm -O0 -g -I. -IC:/hellobone/include
.
The binary also crashes running as root from TTY:
root#beaglebone:~# ./hellobone
Segmentation fault
I installed Eclipse on the BBB Debian and read and write to memory works just fine. Just too slow compiling, and unstable, to be practical.
Reading memory should be doable. What am I doing wrong?
I suspect
GNU gdbserver (GDB) 7.4.1-debian
This gdbserver was configured as "arm-linux-gnueabihf"
But maybe I am missing something obvious, have not seen any post on this problem...
Really stuck. Being working on this for months now. Setting up toolchain very frustrating, nothing works as in YouTube videos..
Any help would be really appreciated
Marco
You need to mmap /dev/mem to access memory mapped peripherals through physical addresses. Easiest example / code I know does this goes by the name devmem2.
Thank you a lot, that certainly helped.
I compiled the program you gave me and it worked perfect in run mode in Eclipse, and in terminal on the remote machine.
Curiously, when running the Eclipse debugger, it crashes executing:
if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL;
I get this error message from gdbserver
Remote debugging from host 192.168.1.2
/root/hellobone: relocation error: /root/hellobone: symbol �pen, version GLIBC_2.4 not defined in file libc.so.6 with link time reference
Child exited with status 127
GDBserver exiting
Have been trying to use fopen but that gives a segmentation fault. Anyhow, I think that is a toolchain issue and not a programming issue.

GenInvokeEnumStackProviders failed

Today I wanted to write a crash dump and I got the error message
0:000> .dump /ma c:\classid_loads_net4.dmp
Creating c:\classid_loads_net4.dmp - mini user dump
GenInvokeEnumStackProviders(C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscordacwks.dll) failed, 0x8007007f
Dump successfully written
I googled for GenInvokeEnumStackProviders but there are no results at all.
What could the reason for this error message be and what impact could this have on the dump (which was successful according the last message)?
Using WinDbg 6.3.9600
Update 2014-09-18
Same error again today, reproducible at the moment. In Process Monitor I can see that WinDbg tries to access verifier.dll while writing the dump
C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x86\verifier.dll
However, the file does not exist in that place. From the list of loaded modules I see it is loaded from
0:008> lm fm verifier
start end module name
6ddf0000 6de50000 verifier C:\Windows\syswow64\verifier.dll
In addition (not sure it is related) I get errors dumping the .NET heap:
0:008> !dumpheap -stat
c0000005 Exception in C:\Windows\Microsoft.NET\Framework\v2.0.50727\sos.dumpheap debugger extension.
PC: 6b55dbe8 VA: 00000000 R/W: 0 Parameter: 00000000
Still using WinDbg 6.3.9600
The problem persists, even after a reboot and after disabling application verifier.

Windbg - !clrstack

I'm attempting to debug a manual dump file of a 64bit w3wp process with 64bit Windbg (Version 6.10). The dump was taken with taskmgr. I can't get anything from the !clrstack command. Here is what I'm getting:
!loadby sos clr
!runaway
User Mode Time
Thread Time
17:cf4 0 days 5:37:42.455
~17s
ntdll!ZwDelayExecution+0xa:
00000000`776208fa c3 ret
!clrstack
GetFrameContext failed: 1
What is GetFrameContext failed: 1?
Use !dumpstack command instead of !clrstack. It usually works.
Try getting the "native" call stack by doing "k" and see what that gets you. Sometimes, the stack isn't quite right and the !ClrStack extension is pretty sensitive.

SBCL error with cl-smtp

This is a recent error that I can't find any documentation for. It might not be cl-smtp specific, but it occurs each time I attempt to evaluate
(cl-smtp:send-email "localhost" "source#email.com" "test#email.com" "TEST" "Testing email from Common Lisp")
from the REPL. The error output is
debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread #<THREAD
"initial thread" RUNNING
{AAE38D1}>:
invalid keyword argument: :SERVE-EVENTS (valid keys are :AUTO-CLOSE, :INPUT,
:OUTPUT, :ELEMENT-TYPE, :EXTERNAL-FORMAT, :BUFFERING, :TIMEOUT).
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-PCL::CHECK-APPLICABLE-KEYWORDS
0
(:AUTO-CLOSE :INPUT :OUTPUT :ELEMENT-TYPE :EXTERNAL-FORMAT :BUFFERING
:TIMEOUT)
-303677905
10)
0] 0
I'm running Debian 6 with postfix and SBCL 1.0.40, and cl-smtp installed via quicklisp. Sending email through the telnet interface with the same source, server, target, subject and body (whether from the same unix user or with root) works fine. This setup also works fine (even from the REPL) on other machines that run the same software stack.
Can anyone see what I'm doing wrong?
That particular error is not coming from cl-smtp. Miscellany googling suggests that it's an internal API mimatch. Looking at the available flags, it seems as if it's a socket error( input, output, buffering, timeout).
SBCL 40 is almost a year old, SBCL 51 is fresh off the presses... I suggest upgrading!