This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] record-full.c: rename record_ in record_full_.


On Thu, 21 Feb 2013 13:52:29 +0100, markus.t.metzger@intel.com wrote:
> --- a/gdb/record-full.c
> +++ b/gdb/record-full.c
[...]
> +static struct target_ops *record_full_beneath_to_xfer_partial_ops;
> +static LONGEST
> +(*record_full_beneath_to_xfer_partial) (struct target_ops *ops,

If it is just a declaration it should be indented:

static LONGEST
  (*record_full_beneath_to_xfer_partial) (struct target_ops *ops,

(Here it is not such a problem but if there was no '(*' then various tools
would mistake it with the function definition.)


> +					enum target_object object,
> +					const char *annex,
> +					gdb_byte *readbuf,
> +					const gdb_byte *writebuf,
> +					ULONGEST offset,
> +					LONGEST len);
> +static int
> +(*record_full_beneath_to_insert_breakpoint) (struct gdbarch *,

Likewise.

> +					     struct bp_target_info *);
> +static int
> +(*record_full_beneath_to_remove_breakpoint) (struct gdbarch *,

Likewise.

> +					     struct bp_target_info *);
> +static int (*record_full_beneath_to_stopped_by_watchpoint) (void);
> +static int (*record_full_beneath_to_stopped_data_address) (struct target_ops *,
> +							   CORE_ADDR *);
> +static void
> +(*record_full_beneath_to_async) (void (*) (enum inferior_event_type, void *),

Likewise.

> +				 void *);
> +
> +static void record_full_goto_insn (struct record_full_entry *entry,
> +				   enum exec_direction_kind dir);
> +static void record_full_save (char *recfilename);
> +
> +/* Alloc and free functions for record_full_reg, record_full_mem, and
> +   record_full_end entries.  */
> +
> +/* Alloc a record_full_reg record entry.  */
> +
> +static inline struct record_full_entry *
> +record_full_reg_alloc (struct regcache *regcache, int regnum)
> +{
> +  struct record_full_entry *rec;
>    struct gdbarch *gdbarch = get_regcache_arch (regcache);
>  
> -  rec = (struct record_entry *) xcalloc (1, sizeof (struct record_entry));
> -  rec->type = record_reg;
> +  rec = (struct record_full_entry *)
> +    xcalloc (1, sizeof (struct record_full_entry));

Again the multi-line Emacs-friendly (I do not use Emacs...) expression with
parentheses:

  rec = ((struct record_full_entry *)
	 xcalloc (1, sizeof (struct record_full_entry)));

(+The cast could be removed there but this patch is just about the renames so
it is OK to keep it there.)


> +  rec->type = record_full_reg;
>    rec->u.reg.num = regnum;
>    rec->u.reg.len = register_size (gdbarch, regnum);
>    if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
[...]
> -static inline struct record_entry *
> -record_mem_alloc (CORE_ADDR addr, int len)
> +static inline struct record_full_entry *
> +record_full_mem_alloc (CORE_ADDR addr, int len)
>  {
> -  struct record_entry *rec;
> +  struct record_full_entry *rec;
>  
> -  rec = (struct record_entry *) xcalloc (1, sizeof (struct record_entry));
> -  rec->type = record_mem;
> +  rec = (struct record_full_entry *)
> +    xcalloc (1, sizeof (struct record_full_entry));

Again missing parentheses.


> +  rec->type = record_full_mem;
>    rec->u.mem.addr = addr;
>    rec->u.mem.len = len;
>    if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
[...]
> -static inline struct record_entry *
> -record_end_alloc (void)
> +static inline struct record_full_entry *
> +record_full_end_alloc (void)
>  {
> -  struct record_entry *rec;
> +  struct record_full_entry *rec;
>  
> -  rec = (struct record_entry *) xcalloc (1, sizeof (struct record_entry));
> -  rec->type = record_end;
> +  rec = (struct record_full_entry *)
> +    xcalloc (1, sizeof (struct record_full_entry));

Again missing parentheses.


> +  rec->type = record_full_end;
>  
>    return rec;
>  }
>  
[...]
> @@ -644,47 +658,50 @@ record_message (struct regcache *regcache, enum gdb_signal signal)
>  
>    discard_cleanups (old_cleanups);
>  
> -  record_list->next = record_arch_list_head;
> -  record_arch_list_head->prev = record_list;
> -  record_list = record_arch_list_tail;
> +  record_full_list->next = record_full_arch_list_head;
> +  record_full_arch_list_head->prev = record_full_list;
> +  record_full_list = record_full_arch_list_tail;
>  
> -  if (record_insn_num == record_insn_max_num && record_insn_max_num)
> -    record_list_release_first ();
> +  if (record_full_insn_num == record_full_insn_max_num &&
> +      record_full_insn_max_num)

Operators are at the beginning - not end - of the line.

  if (record_full_insn_num == record_full_insn_max_num
      && record_full_insn_max_num)


> +    record_full_list_release_first ();
>    else
> -    record_insn_num++;
> +    record_full_insn_num++;
>  
>    return 1;
>  }
>  
[...]
> @@ -1587,34 +1613,36 @@ record_registers_change (struct regcache *regcache, int regnum)
>      {
>        if (record_arch_list_add_reg (regcache, regnum))
>  	{
> -	  record_list_release (record_arch_list_tail);
> +	  record_full_list_release (record_full_arch_list_tail);
>  	  error (_("Process record: failed to record execution log."));
>  	}
>      }
>    if (record_arch_list_add_end ())
>      {
> -      record_list_release (record_arch_list_tail);
> +      record_full_list_release (record_full_arch_list_tail);
>        error (_("Process record: failed to record execution log."));
>      }
> -  record_list->next = record_arch_list_head;
> -  record_arch_list_head->prev = record_list;
> -  record_list = record_arch_list_tail;
> +  record_full_list->next = record_full_arch_list_head;
> +  record_full_arch_list_head->prev = record_full_list;
> +  record_full_list = record_full_arch_list_tail;
>  
> -  if (record_insn_num == record_insn_max_num && record_insn_max_num)
> -    record_list_release_first ();
> +  if (record_full_insn_num == record_full_insn_max_num &&

Again operator to the start of line.


> +      record_full_insn_max_num)
> +    record_full_list_release_first ();
>    else
> -    record_insn_num++;
> +    record_full_insn_num++;
>  }
>  
[...]
> @@ -1705,26 +1735,27 @@ record_xfer_partial (struct target_ops *ops, enum target_object object,
>  	}
>        if (record_arch_list_add_end ())
>  	{
> -	  record_list_release (record_arch_list_tail);
> +	  record_full_list_release (record_full_arch_list_tail);
>  	  if (record_debug)
>  	    fprintf_unfiltered (gdb_stdlog,
>  				"Process record: failed to record "
>  				"execution log.");
>  	  return -1;
>  	}
> -      record_list->next = record_arch_list_head;
> -      record_arch_list_head->prev = record_list;
> -      record_list = record_arch_list_tail;
> +      record_full_list->next = record_full_arch_list_head;
> +      record_full_arch_list_head->prev = record_full_list;
> +      record_full_list = record_full_arch_list_tail;
>  
> -      if (record_insn_num == record_insn_max_num && record_insn_max_num)
> -	record_list_release_first ();
> +      if (record_full_insn_num == record_full_insn_max_num &&
> +	  record_full_insn_max_num)

Again operator to the start of line.


> +	record_full_list_release_first ();
>        else
> -	record_insn_num++;
> +	record_full_insn_num++;
>      }
>  
[...]
>  static void
> -set_record_insn_max_num (char *args, int from_tty, struct cmd_list_element *c)
> +set_record_full_insn_max_num (char *args, int from_tty,
> +			      struct cmd_list_element *c)
>  {
> -  if (record_insn_num > record_insn_max_num && record_insn_max_num)
> +  if (record_full_insn_num > record_full_insn_max_num &&

Again operator to the start of line.


> +      record_full_insn_max_num)
>      {
> -      /* Count down record_insn_num while releasing records from list.  */
> -      while (record_insn_num > record_insn_max_num)
> +      /* Count down record_full_insn_num while releasing records from list.  */
> +      while (record_full_insn_num > record_full_insn_max_num)


Thanks,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]