From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Jaeger To: Andrew Cagney Cc: Jiri Smid , gdb-patches@sources.redhat.com Subject: i386 flavors [Was: Re: Misc; Was: [RFA]: x86_64 target files] Date: Fri, 31 Aug 2001 02:00:00 -0000 Message-id: References: <3B738589.4050605@cygnus.com> <3B8E5021.2070209@cygnus.com> <3B8ED1EB.4070605@cygnus.com> X-SW-Source: 2001-08/msg00316.html Here's a proposal for an implementation - it's similar to the arm way of doing it. I would additionally export print_insn_i386 and then gdb would use that call. i386-tdep.c and x86-64-tdep.c would need to use the new interface, I can send patches if we like to go this way. Mark, as i386 maintainer, what do you think? Andreas typedef struct { const char *name; const char *description; } i386_flavor; static i386_flavor i386_flavors [] = { { "att", "Select ATT syntax."}, { "intel", "Select Intel syntax."} }; enum {ATT_FLAVOR, INTEL_FLAVOR}; static int current_i386_flavor; int get_i386_num_flavors (void) { return sizeof (i386_flavors) / sizeof (i386_flavor); } int set_i386_flavor (int flavor); { int old = current_i386_flavor; current_i386_flavor = flavor; switch (flavor) { case ATT_FLAVOR: intel_syntax = 0; open_char = '('; close_char = ')'; separator_char = ','; scale_char = ','; break; case INTEL_FLAVOR: intel_syntax = 1; open_char = '['; close_char = ']'; separator_char = '+'; scale_char = '*'; break; default: abort (); } return old; } void get_i386_flavor (int flavor, const char **name, const char **description) { *name = i386_flavors [flavor].name; *description = i386_flavors [flavor].description; } -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj