Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Newbie gdb / gdbserver question with x86-64 and -m32 g++ goodness
@ 2010-06-18  6:58 Jerry 85032
  2010-06-18 16:36 ` Michael Snyder
  2010-06-19  3:25 ` Ulrich Weigand
  0 siblings, 2 replies; 5+ messages in thread
From: Jerry 85032 @ 2010-06-18  6:58 UTC (permalink / raw)
  To: gdb


So I am new to using gdb and gdbserver.  And I'm trying to use it on a pretty
complex program.  But that's okay, I can't get it to run on a simple system,
so let's talk about that.

I created the usual c++ Hello World.  I have access to two identical Centos
5 development systems connected with tcp.

#include <iostream>
int main(int argc, char *argv[])
{
    std::cout << "Hello World." << std::endl;
    return -1;

}


If I compile my hello world with:

$ g++ -g hello.cpp -o hello

Then everything works pretty much as expected.  I can run it on either
system.  I can use gdb on one system, connect to gdbserver on the other
system, and everything seems to work fine.  I set a break at main on my
local system, gdbserver the program on the target, use gdb to tell it to
run, and Hello World prints out on the gdbserver system.

But if I compile it with -m32, and repeat the process, then the two systems
seem to be fighting over architecture issues.  I receive messages like
register badly formatted.  Or "warning: Selected architecture i386 is not
compatible with reported target architecture i386:x86-64".  This seems to
happen regardless of how I tell gdb to set the architecture, either i386 or
i386:x86-64.

g++ -g -m32 hello.cpp -o hello

So I gather much of my problem is because I'm ignorant.  And I don't really
understand what -m32 does, although I know our hideously complex system IS
compiled that way.

Apart from that, I am using:

$ g++ --version
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)

$ gdbserver --version
GNU gdbserver Fedora (6.8-37.el5)
This gdbserver was configured as "x86_64-redhat-linux-gnu"

$ cat /etc/redhat-release 
CentOS release 5.4 (Final)

Can someone help clue me in?

Thank you
-- 
View this message in context: http://old.nabble.com/Newbie-gdb---gdbserver-question-with-x86-64-and--m32-g%2B%2B-goodness-tp28922383p28922383.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-19  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-18  6:58 Newbie gdb / gdbserver question with x86-64 and -m32 g++ goodness Jerry 85032
2010-06-18 16:36 ` Michael Snyder
2010-06-18 18:26   ` Jerry 85032
2010-06-18 18:47     ` Michael Snyder
2010-06-19  3:25 ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox