public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: Mike Frysinger <vapier@gentoo.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Define an error function in the PPC simulator.
Date: Tue, 06 Dec 2016 20:18:00 -0000	[thread overview]
Message-ID: <2476434.ez5udtjJNp@ralph.baldwin.cx> (raw)
In-Reply-To: <20161126221946.GR21655@vapier.lan>

On Saturday, November 26, 2016 02:19:46 PM Mike Frysinger wrote:
> On 25 Nov 2016 09:21, John Baldwin wrote:
> > On Friday, November 25, 2016 08:49:08 AM Mike Frysinger wrote:
> > > On 24 Nov 2016 07:29, John Baldwin wrote:
> > > > Previously this used the error function from GDB directly instead of
> > > > the error method in the host callbacks structure.  This was exposed via
> > > > a link error when GDB was converted to C++.  The error function invokes
> > > > the error callback similar to sim_io_error.
> > > 
> > > ppc/main.c and ppc/misc.c already have error() definitions
> > 
> > Yes, though those are not included when libsim is linked into gdb itself.
> > misc.o is explicitly included for certain binaries in sim/ppc/Makefile.in.
> > Note that zalloc() is defined in both misc.c and sim_calls.c as well, I
> > suspect for similar reasons.
> > 
> > Looking at main.c, it overrides various symbols (sim_io_*, also
> > zalloc) that are defined in sim_calls.c with local versions.  (Perhaps
> > psim should not be linking sim_calls.o in at all?)  'error' is another
> > such symbol.
> 
> yes, the ppc sim is a bit of mess due to its history.  i'm not sure we
> should just keep throwing onto the pile though.
> 
> if psim/main.c doesn't need it, then dropping it sounds easy enough.

I misread the Makefiles a bit and psim doesn't link in sim_calls.o, so it
still needs its own zalloc() and error() in main.c.

In particular, ppc/Makefile generates the libsim.a that gdb links against
which includes sim_calls.o (via GDB_OBJ) but not main.o or misc.o.  The
psim binary includes main.o (but not sim_calls.o or misc.o), and the other
binaries (igen, dgen, tmp-filter) include misc.o (but not sim_calls.o or
main.o).

While it might make sense to merge bits of main.c with misc.c, I think the
GDB-specific functions in sim_calls.c are always going to be required
(including a custom error() that invokes GDB's error hook).

-- 
John Baldwin

  reply	other threads:[~2016-12-06 20:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 15:31 John Baldwin
2016-11-25 16:49 ` Mike Frysinger
2016-11-25 18:20   ` John Baldwin
2016-11-26 22:20     ` Mike Frysinger
2016-12-06 20:18       ` John Baldwin [this message]
2016-12-23 21:29         ` John Baldwin

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=2476434.ez5udtjJNp@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).