Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: objdump -M for x86
       [not found] <20011114134429.G6922@bubble.sa.bigpond.net.au>
@ 2001-11-02 12:10 ` Andrew Cagney
  2001-11-02 15:12   ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2001-11-02 12:10 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb

> Applying to mainline.  Note to gdb people: Some backwards compatibility
> stuff can be removed when i386-tdep.c and x86-64-tdep are updated to use
> the new (old!) print_insn_i386.
> 
> binutils/ChangeLog
> 	* doc/binutils.texi (objdump): Document x86 -M options.
> include/ChangeLog
>  	* dis-asm.h (print_insn_i386): Declare.
> opcodes/ChangeLog
> 	* disassemble.c (disassembler): Call print_insn_i386.
> 	* i386-dis.c (SUFFIX_ALWAYS): Define.
> 	(struct dis_private): Add orig_sizeflag.
> 	(print_insn_i386): Make it a wrapper, calling..
> 	(print_insn): ..The old body of print_insn_i386.  Avoid longjmp
> 	warning without using volatile by moving orig_sizeflag to priv,
> 	and removing inbuf.  Parse disassembler_options.
> 	(print_insn_i386_att, print_insn_i386_intel): Move initialisation
> 	code to print_insn.
> 	(putop): Remove #ifdef SUFFIX_ALWAYS.
> 

Hmm, I was wondering what you were talking about until I found this:

> +  for (p = info->disassembler_options; p != NULL; )
> +    {
> +      if (strncmp (p, "x86_64", 6) == 0)
> +	{
> +	  mode_64bit = 1;
> +	  priv.orig_sizeflag = AFLAG | DFLAG;
> +	}
> +      else if (strncmp (p, "i386", 4) == 0)
> +	{
> +	  mode_64bit = 0;
> +	  priv.orig_sizeflag = AFLAG | DFLAG;
> +	}
> +      else if (strncmp (p, "i8086", 5) == 0)
> +	{
> +	  mode_64bit = 0;
> +	  priv.orig_sizeflag = 0;
> +	}
> +      else if (strncmp (p, "intel", 5) == 0)
> +	{
> +	  intel_syntax = 1;
> +	}
> +      else if (strncmp (p, "att", 3) == 0)
> +	{
> +	  intel_syntax = 0;
> +	}
> 

(x86-64?)

Thanks!

Next problem ... If I understand things correctly, the set of possible 
options, for a given ISA family, is finite.  Could that finite list be 
made available via a published interface?  That way GDB could 
incorporate them into its CLI so that things like ``set 
disassembly-options <tab>'' worked.

To get the feel for what I'm talking about check gdb/arm-tdep.c which 
queries opcodes for the ARM register naming conventions.

enjoy,
Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump -M for x86
  2001-11-02 12:10 ` objdump -M for x86 Andrew Cagney
@ 2001-11-02 15:12   ` Alan Modra
  2001-11-02 23:08     ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2001-11-02 15:12 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils, gdb

On Wed, Nov 14, 2001 at 12:28:25AM -0500, Andrew Cagney wrote:
> > Applying to mainline.  Note to gdb people: Some backwards compatibility
> > stuff can be removed when i386-tdep.c and x86-64-tdep are updated to use
> > the new (old!) print_insn_i386.
> 
> Hmm, I was wondering what you were talking about until I found this:

Actually, I was meaning that you don't need to call print_insn_i386_att
or ..._intel;  Just call print_insn_i386 with info->mach set.

> (x86-64?)

Well, x86_64 follows the name used by -m

> Next problem ... If I understand things correctly, the set of possible 
> options, for a given ISA family, is finite.  Could that finite list be 
> made available via a published interface?

Yes, good idea.  Something like:

  const char **opcodes_disasm_options (enum bfd_architecture arch)

returning a malloc'd list of strings for the given arch?

Alan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump -M for x86
  2001-11-02 15:12   ` Alan Modra
@ 2001-11-02 23:08     ` Andrew Cagney
  2001-11-03  1:01       ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2001-11-02 23:08 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb

> 
> Actually, I was meaning that you don't need to call print_insn_i386_att
> or ..._intel;  Just call print_insn_i386 with info->mach set.

Hmm, I didn't see that ....

>  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
>  		|| info->mach == bfd_mach_x86_64);
>  
> +  if (intel_syntax == -1)
> +    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
> +		    || info->mach == bfd_mach_x86_64_intel_syntax);
> +

See my other e-mail.  I can't find anything that sets ->mach to 
.._intel_syntax so, apart from backward compatibility, I can't think of 
a reason to hang on to those ``machine'' variants.  I don't expect GDB 
to start using them again.

>> Next problem ... If I understand things correctly, the set of possible 
>> options, for a given ISA family, is finite.  Could that finite list be 
>> made available via a published interface?
> 
> 
> Yes, good idea.  Something like:
> 
>   const char **opcodes_disasm_options (enum bfd_architecture arch)
> 
> returning a malloc'd list of strings for the given arch?

(if gdb is going to freeargv() it then I don't think you want the const).

Yes, anything like that.  Could add it to bfd_arch_info_type, or .... 
What ever BINUTILS is comfortable with I guess.

We'll need to do things like pin down the semantics.  Which really means 
agree on what something like ``x86-64 i386 i8086 intel att addr16 addr32 
data32 data16 suffix'' actually means, and ensure that GDB doesn't find 
it has accepted a set of options only to find them later rejected by the 
disasssembler.

(May one day need to add pre-parsed disassembler-options to the 
disassemble_info due to the overhead of constant re-parsing.  However, 
cross that bridge when someone notices a real problem :-)

Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump -M for x86
  2001-11-02 23:08     ` Andrew Cagney
@ 2001-11-03  1:01       ` Alan Modra
  2001-11-27 22:37         ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2001-11-03  1:01 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: binutils, gdb

On Wed, Nov 14, 2001 at 03:49:52AM -0500, Andrew Cagney wrote:
> 
> >  mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
> >  		|| info->mach == bfd_mach_x86_64);
> >  
> > +  if (intel_syntax == -1)
> > +    intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
> > +		    || info->mach == bfd_mach_x86_64_intel_syntax);
> > +
> 
> See my other e-mail.  I can't find anything that sets ->mach to 
> .._intel_syntax so, apart from backward compatibility, I can't think of 
> a reason to hang on to those ``machine'' variants.  I don't expect GDB 
> to start using them again.

"objdump -d -m i386:intel" sets it via bfd_default_scan from the entry
in bfd/cpu-i386.c

> We'll need to do things like pin down the semantics.  Which really means 
> agree on what something like ``x86-64 i386 i8086 intel att addr16 addr32 
> data32 data16 suffix'' actually means, and ensure that GDB doesn't find 
> it has accepted a set of options only to find them later rejected by the 
> disasssembler.

Perhaps the thing to do is add a function to bfd_arch_info_type that
validates a -M string for the given arch.  If a null string is passed in,
it could return an array of possible string components.

Alan


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump -M for x86
  2001-11-27 22:37         ` Andrew Cagney
@ 2001-11-18 12:47           ` Andrew Cagney
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2001-11-18 12:47 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb

>> See my other e-mail.  I can't find anything that sets ->mach to 
>> .._intel_syntax so, apart from backward compatibility, I can't think of 
>> a reason to hang on to those ``machine'' variants.  I don't expect GDB 
>> to start using them again.
> 
> 
> "objdump -d -m i386:intel" sets it via bfd_default_scan from the entry
> in bfd/cpu-i386.c

Ahh.  (Sorry only just got back to this).  Groan.

Can I suggest a comment on the test indicating that this can happen -> 
stop me trying to delete ..._intel :-)

Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump -M for x86
  2001-11-03  1:01       ` Alan Modra
@ 2001-11-27 22:37         ` Andrew Cagney
  2001-11-18 12:47           ` Andrew Cagney
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2001-11-27 22:37 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils, gdb

>> See my other e-mail.  I can't find anything that sets ->mach to 
>> .._intel_syntax so, apart from backward compatibility, I can't think of 
>> a reason to hang on to those ``machine'' variants.  I don't expect GDB 
>> to start using them again.
> 
> 
> "objdump -d -m i386:intel" sets it via bfd_default_scan from the entry
> in bfd/cpu-i386.c

Ahh.  (Sorry only just got back to this).  Groan.

Can I suggest a comment on the test indicating that this can happen -> 
stop me trying to delete ..._intel :-)

Andrew



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-11-28  6:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20011114134429.G6922@bubble.sa.bigpond.net.au>
2001-11-02 12:10 ` objdump -M for x86 Andrew Cagney
2001-11-02 15:12   ` Alan Modra
2001-11-02 23:08     ` Andrew Cagney
2001-11-03  1:01       ` Alan Modra
2001-11-27 22:37         ` Andrew Cagney
2001-11-18 12:47           ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox