This is the mail archive of the gdb-patches@sources.redhat.com 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]

[rfa/i386] disconnect ``set dissassembly-flavour'' from ``set architecture''


THis seems somehow wrong to me.

The problem is that in BFD the architecture and the disassembly style 
are not separate bits, so you can't say i386 and oh by the way intel 
printing style, you just switch the architecture. If that is not going 
to change, and gdb has to work around it, then I would expect that gdb 
would have a list of disassembly flavors for each architecture (i386, 
i586, whatever) and a mapping from that pair {gdb-architecture, 
disassembly flavor} -> bfd architecture.  Then when you switched 
disassembly flavors, gdb would look up the bfd architecture appropriate 
to that flavor, and use it.

There are different architectures for each flavor in the i386 case.  I 
am not a big BFD expert, but when I originally did this, whoever was 
working on the BFD side told me I ought to make this change too.  If 
there are not for the other x86 architectures in BFD, that is not a 
problem, both flavors would just map to the same bfd architecture for 
this gdb architecture.  But just not telling bfd about the change, when 
in at least one case - i386 - bfd wants to know, seems wrong.

Jim

On Thursday, November 8, 2001, at 09:36  AM, gdb-patches-digest-
help@sources.redhat.com wrote:

>
>
> Hello,
>
> Per discussion on GDB@ mailing list.  The attached disconnects the 
> commands:
>
> 	set disssassembly-flavour
>  and	set architecture
>
> ok to commit?
>
> Andrew
> Wed Nov  7 20:45:32 2001  Andrew Cagney  <cagney@redhat.com>
>
> 	* i386-tdep.c (set_disassembly_flavor): Delete function.
> 	(set_disassembly_flavor_sfunc): Delete function.
>
> Index: i386-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-tdep.c,v
> retrieving revision 1.42
> diff -p -r1.42 i386-tdep.c
> *** i386-tdep.c	2001/11/04 13:51:48	1.42
> --- i386-tdep.c	2001/11/08 02:00:02
> *************** static const char *valid_flavors[] =
> *** 188,200 ****
>   };
>   static const char *disassembly_flavor = att_flavor;
>
> - /* This is used to keep the bfd arch_info in sync with the disassembly
> -    flavor.  */
> - static void set_disassembly_flavor_sfunc (char *, int,
> - 					  struct cmd_list_element *);
> - static void set_disassembly_flavor (void);
> - 
> -
>   /* Stdio style buffering was used to minimize calls to ptrace, but
>      this buffering did not take into account that the code section
>      being accessed may not be an even number of buffers long (even if
> --- 188,193 ----
> *************** gdb_print_insn_i386 (bfd_vma memaddr, di
> *** 1200,1225 ****
>     internal_error (__FILE__, __LINE__, "failed internal consistency 
> check");
>   }
>
> - /* If the disassembly mode is intel, we have to also switch the bfd
> -    mach_type.  This function is run in the set disassembly_flavor
> -    command, and does that.  */
> -
> - static void
> - set_disassembly_flavor_sfunc (char *args, int from_tty,
> - 			      struct cmd_list_element *c)
> - {
> -   set_disassembly_flavor ();
> - }
> -
> - static void
> - set_disassembly_flavor (void)
> - {
> -   if (disassembly_flavor == att_flavor)
> -     set_architecture_from_arch_mach (bfd_arch_i386, 
> bfd_mach_i386_i386);
> -   else if (disassembly_flavor == intel_flavor)
> -     set_architecture_from_arch_mach (bfd_arch_i386,
> - 				     bfd_mach_i386_i386_intel_syntax);
> - }
>   
>
>   /* Provide a prototype to silence -Wmissing-prototypes.  */
> --- 1193,1198 ----
> *************** _initialize_i386_tdep (void)
> *** 1255,1265 ****
>   Set the disassembly flavor, the valid values are \"att\" and 
> \"intel\", \
>   and the default value is \"att\".",
>   				&setlist);
> -     new_cmd->function.sfunc = set_disassembly_flavor_sfunc;
>       add_show_from_set (new_cmd, &showlist);
>     }
> -
> -   /* Finally, initialize the disassembly flavor to the default given
> -      in the disassembly_flavor variable.  */
> -   set_disassembly_flavor ();
>   }
> --- 1228,1233 ----
>
>
--
Jim Ingham                                   jingham@apple.com
Developer Tools - gdb
Apple Computer


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