Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: luisgpm@linux.vnet.ibm.com
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] "single step" atomic instruction sequences as a whole on PPC
Date: Sun, 06 May 2007 21:20:00 -0000	[thread overview]
Message-ID: <200705062120.l46LKf9l023985@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <1178203875.4375.8.camel@localhost> from "Luis Machado" at May 03, 2007 11:51:15 AM

Luis Machado wrote:

> I've modified the patch according to your suggestions. Any additional
> comments on it?

Thanks for the modifications.  There's still a number of coding style
issues that I'll point out below.

> Any suggestions for the duplicate breakpoint detection? Maybe it could
> be handled in a better way.

Unfortunately your attempt to handle more than a single conditional
branch within the sequence doesn't work, as insert_single_step_breakpoint
cannot be called more than twice (it'll raise an assertion).

I think you should make the assumption that there will be at most
one conditional branch, but fail gracefully it that assumption is
in fact violated (e.g. by issuing a warning and returning 0 to fall
back on the standard single-step code).

> +static int 
> +deal_with_atomic_sequence(struct regcache *regcache)
Space before '('.

> +{
> +  CORE_ADDR pc = read_pc ();
> +  CORE_ADDR breaks[16] = {-1, -1, -1, -1, -1, -1, -1, -1,
> +                          -1, -1, -1, -1, -1, -1, -1, -1};
> +  CORE_ADDR branch_bp; /* Breakpoint at destination of a banch instruction */
Typo: "banch"
Comment should end with '.' followed by two spaces.

> +  int index; /* Index used for the "breaks" arrays */
> +  int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed) */  
> +  const int opcode = BC_INSTRUCTION; /* Branch instruction's OPcode */
Likewise.

> +  if ((insn & LWARX_MASK) != LWARX_INSTRUCTION
> +   && (insn & LWARX_MASK) != LDARX_INSTRUCTION)
Indentation wrong.

> +      /* Check for conditiconal branches in the middle of the sequence
Typo "conditiconal"

> +          branch_bp = branch_dest(opcode, insn, pc, breaks[0]);
Space before '('.

> +      if ((insn & STWCX_MASK) == STWCX_INSTRUCTION
> +       || (insn & STWCX_MASK) == STDCX_INSTRUCTION)
Indentation.

> +  /* Assume that the atomic sequence ends with a stwcx/stdcx instruction */
Comment should end with full stop.

> +  if ((insn & STWCX_MASK) != STWCX_INSTRUCTION
> +   && (insn & STWCX_MASK) != STDCX_INSTRUCTION)
Indentation.

> +      warning (_("\nTried to step over an atomic sequence of instructions at %s\n \
> +                  but could not find the end of the sequence."),
This leaves a lot of spaces in the warning text.

> +                  core_addr_to_string(pc));
Space before '('.

> +  /* Insert a breakpoint right after the end of the atomic sequence */
Comment should end with full stop.

> +  /* Effectively inserts all the breakpoints */
Likewise

> +  for (index = 0; index < last_breakpoint; index++)
> +    insert_single_step_breakpoint (breaks[index]);
> +
> +  gdb_flush (gdb_stdout);
I don't think this is necessary.

> +  if (deal_with_atomic_sequence(regcache))
Space before '('.

> +  /* Handles single stepping of atomic sequences */
Comment should end with full stop.
> +  set_gdbarch_software_single_step(gdbarch, deal_with_atomic_sequence);
Space before '('.


Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2007-05-06 21:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1177964763.15264.45.camel@localhost>
2007-05-02 14:08 ` uweigand
2007-05-03 14:51   ` Luis Machado
2007-05-06 21:20     ` Ulrich Weigand [this message]
2007-05-07 15:14       ` Luis Machado
2007-05-07 18:11         ` Ulrich Weigand
2007-05-07 19:28           ` Luis Machado
2007-05-07 22:47             ` Ulrich Weigand
2007-05-07 23:23               ` Luis Machado
2007-05-08 12:50                 ` Ulrich Weigand
2007-05-09 14:33                 ` Ulrich Weigand
2007-05-09 18:05                   ` Luis Machado
2007-05-09 18:12                     ` Daniel Jacobowitz
2007-05-09 18:21                       ` Luis Machado
2007-05-09 18:34                         ` Jan Kratochvil
2007-05-09 18:46                           ` Daniel Jacobowitz
2007-05-09 19:10                             ` Ulrich Weigand
2007-05-09 19:14                           ` Luis Machado
2007-05-10 10:57                           ` Emi SUZUKI
2007-05-10 21:31                             ` Ulrich Weigand
2007-05-10 21:36                               ` Daniel Jacobowitz
2007-05-10 22:58                                 ` Ulrich Weigand
2007-05-10 23:25                                   ` Daniel Jacobowitz
2007-05-11  7:34                                   ` Emi SUZUKI
2007-05-11 12:46                                     ` Ulrich Weigand
2007-05-09 19:45                         ` Ulrich Weigand
2007-05-10  0:48                           ` Luis Machado
2007-05-10 20:29                             ` Ulrich Weigand
2007-04-09  2:13 Patch for gdb build on hppa hp-ux Daniel Jacobowitz
2007-04-09 23:25 ` Steve Ellcey
2007-04-10 12:05   ` Daniel Jacobowitz
2007-04-10 19:03     ` Eli Zaretskii
2007-04-10 20:22       ` Daniel Jacobowitz
2007-04-13 14:04         ` Daniel Jacobowitz
2007-04-13 17:07           ` [patch] "single step" atomic instruction sequences as a whole on PPC Luis Machado
2007-04-28 23:34             ` [RFC] " Luis Machado
2007-04-28 23:45               ` Ulrich Weigand
2007-04-29  1:53                 ` Luis Machado

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=200705062120.l46LKf9l023985@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luisgpm@linux.vnet.ibm.com \
    /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