From: Joel Brobecker <brobecker@adacore.com>
To: fei ding <fdingiit@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: How does GDB know the architecture of an executable?
Date: Fri, 16 Jan 2015 06:56:00 -0000 [thread overview]
Message-ID: <20150116065646.GH28195@adacore.com> (raw)
In-Reply-To: <CAGmPkfLEjBCy_A4z0AS5hFkwySDDKwGP6JsaVk2usARSD8sJPw@mail.gmail.com>
> 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.
There are a number of elements GDB uses to determine the exact
"arch" to use. A lot of it relies on the "bfd" library, which
is part of binutils, to tell us. On GNU/Linux, I'd take a look
at the ELF documentation.
--
Joel
prev parent reply other threads:[~2015-01-16 6:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 3:48 fei ding
2015-01-16 6:56 ` Joel Brobecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150116065646.GH28195@adacore.com \
--to=brobecker@adacore.com \
--cc=fdingiit@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox