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]
Other format: [Raw text]

Re: [PATCH] set osabi command


Hi,

This patch adds a set osabi <which> command that it used to override the
automatic osabi detection. This is needed for some libary that don't
provide the .note.ABI-tag and the auto detection fails.
Thanks! While the command works, I think it can be improved upon.

Have a look at the existing ``set architecture'' command. For instance:

(gdb) set debug architecture 1
(gdb) set architecture <tab>
... a list of architectures ...
(gdb) set architecture <choose-one>
... gdb will immediatly change architecture updating everthing ...
(gdb) set architecture <rubbish>
... and error message should appear and the architecture doesn't change ...
(gdb) set architecture auto
... gdb's architecture is determined by the target ...

I think a ``set osabi'' command should be similar in that it always and immediatly has an effect.

It gets complex though because the user could enter a sequence like:

(gdb) set architecture arm
... architecture forced to arm ...
(gdb) set osabi arm_eabi_v1
... osabi forced to arm_eabi_v1
(gdb) set architecture mips
... architecture forced to mips, what should happen to the OSABI? It can't remain arm_eabi_v1 ...

Idea's?

+static char *osabi_set_val = NULL;
+
+enum gdb_osabi
+gdbarch_osabi_var_set ()
+{
FYI, it is important that the OSABI not be hardwired in this way.

+    if (strcmp(osabi_set_val, "SVR4") == 0)
+       return GDB_OSABI_SVR4;

+  c = add_set_cmd ("osabi", class_support, var_string,
+    (char *) &osabi_set_val, "Set the osabi. Posible targets are: linux,
+    hurd, irix, freebsd_aout, freebsd_elf, netbsd_aout, netbsd_aout,
+    netbsd_elf, OSF1, SVR4, solaris, wince, netware, go32, arm_apcs,
+    arm_eabi_v1, arm_eabi_v2, lynxos", &setlist);
+  add_show_from_set (c, &showlist);
+  set_cmd_completer (c, filename_completer);
+
Have a look at the add_set_enum() command.

Andrew



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