Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Tobler <andreast-list@fgznet.ch>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] patch to refactor ppc64 specific code from ppc-linux-tdep
Date: Fri, 01 Feb 2013 20:55:00 -0000	[thread overview]
Message-ID: <510C2BB3.3070501@fgznet.ch> (raw)
In-Reply-To: <510C109C.6070205@redhat.com>

Hi Pedro,

On 01.02.13 19:59, Pedro Alves wrote:
> On 01/26/2013 04:24 PM, Andreas Tobler wrote:

>>>> Also, GDB's convention is that the function name goes on the first
>>>> column in function definitions only, not declarations, and that
>>>> declarations in .h files get an explicit "extern".
>> Done, not sure if I need the extern on ppc64-tdep.h too?
> 
> Yes.
> 
>> 2013-01-26  Andreas Tobler  <andreast@fgznet.ch>
>>
>> 	* Makefile.in (ALL_TARGET_OBS): Add new file ppc64-tdep.o.
>> 	(HFILES_NO_SRCDIR): Likewise.
>> 	(ALLDEPFILES): Likewise.
> 
>  	* Makefile.in (ALL_TARGET_OBS): Add ppc64-tdep.o.
>  	(HFILES_NO_SRCDIR): Add ppc64-tdep.h.
>  	(ALLDEPFILES): Add ppc64-tdep.c.
> 
> 
>> 	* configure.tgt: Add new file for powerpc-linux.
> 
> 	* configure.tgt (powerpc-*-linux* | powerpc64-*-linux*): Add ppc64-tdep.o
>         to gdb_target_obs.
> 
>> 	* ppc64-tdep.h: New file.
>> 	* ppc64-tdep.c: New file.
>> 	(insn_d, insn_ds, insn_xfx, ppc64_desc_entry_point): Move from
>> 	ppc-linux-tdep.c to here.
>> 	(PPC64_STANDARD_LINKAGE1_LEN, PPC64_STANDARD_LINKAGE2_LEN)
>> 	(PPC64_STANDARD_LINKAGE2_LEN): Likewise and use ARRAY_SIZE macro.
>> 	(ppc64_standard_linkage1_target, ppc64_standard_linkage2_target)
>> 	(ppc64_standard_linkage3_target, ppc64_skip_trampoline_code): Move
>> 	from ppc-linux-tdep.c to here.
>> 	(ppc64_convert_from_func_ptr_addr): Rename it from
>> 	ppc64_linux_convert_from_func_ptr_addr to
>> 	ppc64_convert_from_func_ptr_addr and move it from ppc-linux-tdep.c to
>> 	here.
> 
> Drop the "it"s.
> 
>> 	* rs6000-tdep.c:
>> 	(read_insn): Move from ppc-linux-tdep.c to here.
>> 	(insns_match_pattern, insn_d_field, insn_ds_field): Move
>> 	from ppc-linux-tdep.c to here and rename them with the ppc_ prefix.
>> 	* ppc-linux-tdep.c: Include ppc64-tdep.h.
>> 	Removed above functions.
> 
> 
>> 	(ppc_linux_init_abi): Rename
>> 	ppc64_linux_convert_from_func_ptr_addr to
>> 	ppc64_convert_from_func_ptr_addr.
> 
>  	(ppc_linux_init_abi): Adjust.
> 
> 
>> diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
>> index 9be9666..b268e90 100644
>> --- a/gdb/ppc-tdep.h
>> +++ b/gdb/ppc-tdep.h
>> @@ -291,6 +291,23 @@ enum {
>>    PPC_NUM_REGS
>>  };
>>  
>> +/* An instruction to match.  */
>> +
>> +struct ppc_insn_pattern
>> +{
>> +  unsigned int mask;            /* mask the insn with this...  */
>> +  unsigned int data;            /* ...and see if it matches this.  */
>> +  int optional;                 /* If non-zero, this insn may be absent.  */
>> +};
>> +
>> +extern int
>> +ppc_insns_match_pattern (CORE_ADDR pc, struct ppc_insn_pattern *pattern,
>> +			 unsigned int *insn);
>> +extern CORE_ADDR
>> +ppc_insn_d_field (unsigned int insn);
>> +
>> +extern CORE_ADDR
>> +ppc_insn_ds_field (unsigned int insn);
> 
> Here, GDB's convention is that the function name goes on the first
> column in function definitions only, not declarations.  So:
> 
> extern int ppc_insns_match_pattern (CORE_ADDR pc,
> 				    struct ppc_insn_pattern *pattern,
> 				    unsigned int *insn);
> 
> extern CORE_ADDR ppc_insn_d_field (unsigned int insn);
> 
> extern CORE_ADDR ppc_insn_ds_field (unsigned int insn);
> 
> 
> This is so 'grep ^functionname" finds function definitions.
> 
>>  
>>  /* Instruction size.  */
>>  #define PPC_INSN_SIZE 4
>> diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
>> new file mode 100644
>> index 0000000..cdf8f4d
>> --- /dev/null
>> +++ b/gdb/ppc64-tdep.c
>> @@ -0,0 +1,364 @@
>> +/* Common target-dependent code for ppc64 GDB, the GNU debugger.
>> +
>> +   Copyright (C) 2013 Free Software
>> +   Foundation, Inc.
> 
> This is existing code, not new code.  Please retain the copyright
> the copyright years of the file(s) the code has been copied from.
> 
> This is okay with these issues fixed.
> 
> Thanks again for doing this.

Commit done, thank you for the patience!

Andreas


      reply	other threads:[~2013-02-01 20:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 21:36 Andreas Tobler
2013-01-19 13:46 ` Andreas Tobler
2013-01-21 15:50 ` Pedro Alves
2013-01-26 16:24   ` Andreas Tobler
2013-02-01 19:00     ` Pedro Alves
2013-02-01 20:55       ` Andreas Tobler [this message]

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=510C2BB3.3070501@fgznet.ch \
    --to=andreast-list@fgznet.ch \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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