public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA 3/3] gdbserver support for powerpc-lynxos (4.x)
Date: Tue, 31 Aug 2010 20:24:00 -0000	[thread overview]
Message-ID: <201008312124.37086.pedro@codesourcery.com> (raw)
In-Reply-To: <20100831193731.GN2986@adacore.com>

On Tuesday 31 August 2010 20:37:31, Joel Brobecker wrote:
>     Note that I'm adding a new varialble "srv_extra_libs" in configure.srv.
>     I need this because I need to link against -linet. Perhaps the right way
>     of doing things might have been to use a configure check...

I think this comment is stale.

> +      status->kind = TARGET_WAITKIND_EXITED;
> +      status->value.integer = target_signal_from_host (WEXITSTATUS (wstat));

This target_signal_from_host call is wrong here.  The program's exit status
is not a signal (see gdb/target.c:store_waitstatus).

> +  /* SIGTRAP events are generated for situations other than single-step/
> +     breakpoint events (Eg. new-thread events).  Handle those other types
> +     of events, and resume the execution if necessary.  */
> +  if (status->kind == TARGET_WAITKIND_STOPPED
> +      && status->value.integer == target_signal_from_host (SIGTRAP))

Just write TARGET_SIGNAL_TRAP.

> +static int
> +lynx_kill (int pid)
> +{
> +  ptid_t ptid = lynx_ptid_build (pid, 0);
> +  struct target_waitstatus status;
> +
> +  lynx_ptrace (PTRACE_KILL, ptid, 0, 0, 0);
> +  lynx_wait (ptid, &status, 0);
> +  return 0;
> +}

Should call the_target->mourn (process);

> +/* Implement the detach target_ops method.  */
> +
> +static int
> +lynx_detach (int pid)
> +{
> +  ptid_t ptid = lynx_ptid_build (pid, 0);
> +
> +  lynx_ptrace (PTRACE_DETACH, ptid, 0, 0, 0);
> +  return 0;
> +}

Should call the_target->mourn (process);

> +      buf = lynx_ptrace (PTRACE_PEEKTEXT, inferior_ptid, addr, 0, 0);
> +      if (errno)
> +        return errno;

lynx_ptrace is not taking care of preserving the errno set by the
ptrace call:

> +  result = ptrace (request, pid, addr, data, addr2);
> +  if (debug_threads)
> +    printf (" -> %d (=0x%x)\n", result, result);
> +
> +  return result;
> +}

... that printf call clobbers errno when debug_threads is on.  And
you should use "fprintf (stderr, " for debug output throughout.

> +      memcpy (myaddr + (addr - memaddr) + skip, (gdb_byte *)&buf + skip,

You should have a space after the cast (there are more instances of this).

Other than that it looks fine to me.

-- 
Pedro Alves

  reply	other threads:[~2010-08-31 20:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 17:46 Add support for ppc-lynxos to GDBserver Joel Brobecker
2010-06-23 17:46 ` [RFA 2/3] Import vsnprintf from libiberty if not available Joel Brobecker
2010-06-23 19:19   ` Joseph S. Myers
2010-06-24 12:08   ` Pierre Muller
2010-06-24 12:40     ` Pierre Muller
2010-06-23 17:46 ` [RFA 1/3] Generate regformats/rs6000/powerpc-32.dat Joel Brobecker
2010-06-23 17:46 ` [RFA 3/3] gdbserver support for powerpc-lynxos (4.x) Joel Brobecker
2010-07-27 16:13   ` Pedro Alves
2010-08-31 19:38     ` Joel Brobecker
2010-08-31 20:24       ` Pedro Alves [this message]
2010-09-01 18:36         ` Joel Brobecker
2010-09-01 18:42           ` Pedro Alves
2010-09-01 19:00             ` Joel Brobecker

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=201008312124.37086.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).