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] Collect return addresses at tracepoints


On 09/22/2011 05:45 AM, Stan Shebs wrote:

Stan,
I don't know the code very well, just two cents on function comment.

> Index: amd64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/amd64-tdep.c,v

>   
> + /* Generate a bytecode expression to get the value of the saved PC.
> +    Since this is supposed to run on the target independently of GDB,
> +    we don't have the full power of the unwinding machinery.  Instead,
> +    make a guess as to the most likely location of the return address,
> +    and issue byte codes for that.  */
> + 
> + void
> + amd64_gen_return_address (struct gdbarch *gdbarch,
> + 			  struct agent_expr *ax, struct axs_value *value,
> + 			  CORE_ADDR scope)

The comments on function amd64_gen_return_address and
i386_gen_return_address are identical.  I suggest that we move this
comment to gdbarch.sh ...

and write comment on function amd64_gen_return_address and
i386_gen_return_address like this,

/* This is the implementation of gdbarch method gen_return_address.  */

> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.523
> diff -p -r1.523 gdbarch.sh
> *** gdbarch.sh	22 Jul 2011 15:31:50 -0000	1.523
> --- gdbarch.sh	21 Sep 2011 21:27:00 -0000
> *************** v:const char *:solib_symbols_extension::
> *** 820,825 ****
> --- 820,829 ----
>   # is, absolute paths include a drive name, and the backslash is
>   # considered a directory separator.
>   v:int:has_dos_based_file_system:::0:0::0
> + 
> + # Generate bytecodes to collect the return address in a frame.
> + m:void:gen_return_address:struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope:ax, value, scope::default_gen_return_address::0
> + 

... here, and document the each parameter in comment.

> Index: i386-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-tdep.c,v

>   
> + /* Generate a bytecode expression to get the value of the saved PC.
> +    Since this is supposed to run on the target independently of GDB,
> +    we don't have the full power of the unwinding machinery.  Instead,
> +    make a guess as to the most likely location of the return address,
> +    and issue byte codes for that.  */
> + 
> + void
> + i386_gen_return_address (struct gdbarch *gdbarch,
> + 			 struct agent_expr *ax, struct axs_value *value,
> + 			 CORE_ADDR scope)


-- 
Yao (éå)


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