Unable to use cross-compiled gdb with host=intel target=ppc
Nicholas Basker
nbasker at india.tejasnetworks.com
Sat Dec 15 01:53:30 EST 2001
Hi:
We are using hardhat linux for powerpc in embedded system
development. I am facing a problem in using cross-compiled
gdb to analize powerpc core files from intel
machines. The sample program that I have written is
class t1
{
public:
static t1& create()
{
t1* j = 0;
j = new t1();
return *j;
};
t1()
{
mynum = 5;
};
~t1()
{};
void getMyNum(unsigned int* n)
{
*n = mynum;
int *i;
i = 0;
*i = 55;
};
private:
static unsigned int mynum;
};
unsigned int t1::mynum;
main() {
unsigned int j1 = 77;
t1& myc = t1::create();
myc.getMyNum(&j1);
}
I compiled the above program using the following command
ppc_8xx-g++ -Xlinker -Bstatic -o t -g t.cpp and executed
on powerpc machine. It created a core file. I analized the
core file using the cross-gdb that we got from hardhat
distribution. It gives the following error
[nbasker at google ~/utils]$ ppc_8xx-gdb t-ppc
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "powerpc-hardhat-linux"...
(gdb) core core_t
warning: Couldn't find general-purpose registers in core file.
warning: wrong size fpregset struct in core file
warning: Couldn't find general-purpose registers in core file.
warning: wrong size fpregset struct in core file
#0 0x0 in ?? ()
(gdb)
(gdb) bt
#0 0x0 in ?? ()
(gdb)
I compiled the same program for Intel and used gdb to analize
the core file. I was able to get correct information as shown
below:
[nbasker at google ~/utils]$ gdb t
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
(gdb) core core
Core was generated by `./t'.
Program terminated with signal 11, Segmentation fault.
#0 0x80748da in t1::getMyNum (this=0x80810d8, n=0xbffff9f4) at t.cpp:27
27 *i = 55;
(gdb) bt
#0 0x80748da in t1::getMyNum (this=0x80810d8, n=0xbffff9f4) at t.cpp:27
#1 0x80481bd in main () at t.cpp:45
I would appreciate any help on why the errors given by
cross-compiled gdb.
Thanks for your time,
Nicholas.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-embedded
mailing list