We’re having a lot of trouble with using C++ on your PC-104 (Arcom) SBC’s.
We keep getting “Memory Error” and I’m at loss of how to debug this. How
do I know whether I’m just running out of memory as opposed to a segfault?
How do I even check how much memory I’m using vs. what’s free?
Also, is there an equivalent of the Linux ‘ldd’ command?
Any hints as to how I can work on debugging it would be appreciated.
Dana
Setup:
devel system: PIII, running plain patch A (installed from QNX CD,
nothing major touched) (just /etc/passwd, etc…)
target: Arcom Elan board running an image built on the Pentium
with libstc++.so copied over from the pentium onto the target.
Source file:
#include <iostream.h>
int main (int argc, char *argv[])
{
cout << “Hello world \n”;
return (0);
}
Situation 1:
When compiled with
g++ -g -static hello.c -L/usr/lib -o hello
It runs fine on the devel system, but on the target it gives a Memory Fault.
When run with gdb, I get
\
\
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x8055734 in _init_libc ()
(gdb)
\
\
Situation 2:
When compiled with
g++ -g hello.c -o hello
it runs on both systems.
Situation 3:
A longer C++ program instead of "hello world" is used.
When compiled with
g++ -gstabs etc..etc.. (normal dynamic linking)
it runs normally on the development
systems, but gives a memory fault on the target.
When run with GDB, the error is:
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x804a122 in __do_global_ctors_aux ()
(gdb)
\
\
\
--
Dana Echtner \ Real-Time Systems Administrator
<dana@ece.concordia.ca> / ECE, Concordia University, Montreal, Canada
rw-rw-rw-: The file protection of the beast