How does GDB know the architecture of an executable?

fei ding <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAGmPkfLEjBCy_A4z0AS5hFkwySDDKwGP6JsaVk2usARSD8sJPw@mail.gmail.com>
Hi guys:

I'm wondering how does GDB know the architecture of an executable, for
example, if I use -m32 options in gcc and I can get an i386
executable, if I use nothing I'll get a x86-64 executable while I am
compiling code on a 64-bit Linux.

I've see the source code for one day but I cannot get what I want, at
first I think '''struct gdbarch''' has something with it. Can anyone
help me? I want to know everything about this.

Thanks a lot.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.