Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Michael Eager <eager@eagercon.com>,
	Pedro Alves <palves@redhat.com>,
	Vinod Kathail <vinodk@xilinx.com>,
	Vidhumouli Hunsigida <vidhum@xilinx.com>,
	Nagaraju Mekala <nmekala@xilinx.com>
Subject: Re: [Patch, microblaze]: Add support of microblaze software single stepping
Date: Fri, 11 Jul 2014 14:05:00 -0000	[thread overview]
Message-ID: <20140711135114.GA4888@adacore.com> (raw)
In-Reply-To: <35bccb81-cae6-4581-b5fd-16dea7171d28@BN1AFFO11FD012.protection.gbl>

> Based on the feedback review comments are incorporated. 
> ChangeLog:
> 2014-07-11  Ajit Agarwal  <ajitkum@xilinx.com>
> 
> 	* microblaze-tdep.c (microblaze_software_single_step): New.
> 	(microblaze_gdbarch_init): Use of set_gdbarch_software_single_step.

Thank you. Some additional trivial coments below.

Please also explain how this patch was tested.

> +/* This function handles software single step, branches with delay slot
> +   imm instruction in microblaze.  */
> +static int
> +microblaze_software_single_step (struct frame_info *frame)

Two comments, in this case: My first comment is that the GDB coding
style requires a space after the comment describing the function,
before the function itself starts.

The second is that functions meant to be installed as gdbarch hooks
should be documented as such. The theory is that the purpose of
these functions, as well as their API, is documented in the gdbarch
code, and thus does not need to be repeated here. So, the typical
function description for these functions is:

/* Implement the software_single_step gdbarch method.  */

If you feel that the extra information you had above is useful,
just add it after the introductory comment, like so, for instance:

/* Implement the software_single_step gdbarch method.

   This function handles software single step, branches with delay slot
   imm instruction in microblaze.  */

> +  /* Set a breakpoint at the next instruction. If the current
> +     instruction is an imm, set it at the inst after. If the
> +     instruction has a delay slot, skip the delay slot.  */

This comment could also be merged with the comment above.  Or, if
you prefer, the extra info from the function documentation could
also be merged with this comment.

Formatting note: 2 spaces after periods.

> +  pc = get_frame_pc (frame);
> + 
> +  insn = microblaze_fetch_instruction (pc);
> +
> +  minstr = get_insn_microblaze (insn,
> +                                &isunsignednum,
> +                                &insn_type,
> +                                &delay_slots);

I will leave it to you to decide, but we typically do not write function
calls with one argument per line, unless perhaps when the arguments
are function calls, where having one per line would help the reader
find which arguments belong to which function call. Particularly in
the case below....

> +      minstr = microblaze_decode_insn (insn,
> +                                       &rd,
> +                                       &ra,
> +                                       &rb,
> +                                       &imm);

... joining all arguments on the same line would save you a lot of
screen real estate.

> +  if (insn_type != return_inst)
> +    breaks[0] = pc + delay_slots * INST_WORD_SIZE + INST_WORD_SIZE;
> +    

Trailing spaces here.

> +      bfd_boolean targetvalid;
> +      bfd_boolean unconditionalbranch;
> + 

And here.

> +      if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
> +        rb = get_frame_register_unsigned (frame, lrb);
> +      else
> +        rb = 0;
> + 

And here.

> +      address = microblaze_get_target_address (insn,
> +                                               immfound,
> +                                               imm,
> +                                               pc,
> +                                               ra,
> +                                               rb,
> +                                               &targetvalid,
> +                                               &unconditionalbranch);
> +        
> +      if (!unconditionalbranch)
> +        breaks[1] = address;
> +    }  
> +    

And there (3 lines have trailing spaces)

Thank you,
-- 
Joel


  reply	other threads:[~2014-07-11 13:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06  6:13 Ajit Kumar Agarwal
2014-07-07 14:56 ` Joel Brobecker
2014-07-11 12:53   ` Ajit Kumar Agarwal
2014-07-11 14:05     ` Joel Brobecker [this message]
2014-07-11 14:42       ` Ajit Kumar Agarwal
2014-07-11 19:44       ` Ajit Kumar Agarwal
2014-07-11 20:58         ` Michael Eager
2014-07-14 11:42           ` Ajit Kumar Agarwal
2014-09-15 16:06             ` Michael Eager
2014-07-20 14:03       ` Ajit Kumar Agarwal
  -- strict thread matches above, loose matches on Subject: below --
2014-06-20  6:10 Ajit Kumar Agarwal

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=20140711135114.GA4888@adacore.com \
    --to=brobecker@adacore.com \
    --cc=ajit.kumar.agarwal@xilinx.com \
    --cc=eager@eagercon.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nmekala@xilinx.com \
    --cc=palves@redhat.com \
    --cc=vidhum@xilinx.com \
    --cc=vinodk@xilinx.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