Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Posnjak <simon.posnjak@siol.net>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] set osabi command
Date: Thu, 15 Aug 2002 14:19:00 -0000	[thread overview]
Message-ID: <1029446386.30623.13.camel@klada.dyndns.org> (raw)

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.

	Regards Simon

--- /tmp/gdb+dejagnu-20020813/gdb/osabi.c       Sat Jul 27 03:28:43 2002
+++ osabi.c     Thu Aug 15 16:21:23 2002
@@ -20,6 +20,9 @@

 #include "defs.h"
 #include "osabi.h"
+#include "command.h"
+#include "gdbcmd.h"
+#include "completer.h"

 #include "elf-bfd.h"

@@ -52,6 +55,48 @@
   "<invalid>"
 };

+static char *osabi_set_val = NULL;
+
+enum gdb_osabi
+gdbarch_osabi_var_set ()
+{
+    if (strcmp(osabi_set_val, "SVR4") == 0)
+       return GDB_OSABI_SVR4;
+    if (strcmp(osabi_set_val, "hurd") == 0)
+       return GDB_OSABI_HURD;
+    if (strcmp(osabi_set_val, "solaris") == 0)
+       return GDB_OSABI_SOLARIS;
+    if (strcmp(osabi_set_val, "OSF1") == 0)
+       return GDB_OSABI_OSF1;
+    if (strcmp(osabi_set_val, "linux") == 0)
+       return GDB_OSABI_LINUX;
+    if (strcmp(osabi_set_val, "freebsd_aout") == 0)
+       return GDB_OSABI_FREEBSD_AOUT;
+    if (strcmp(osabi_set_val, "freebsd_elf") == 0)
+       return GDB_OSABI_FREEBSD_ELF;
+    if (strcmp(osabi_set_val, "netbsd_aout") == 0)
+       return GDB_OSABI_NETBSD_AOUT;
+    if (strcmp(osabi_set_val, "netbsd_elf") == 0)
+       return GDB_OSABI_NETBSD_ELF;
+    if (strcmp(osabi_set_val, "wince") == 0)
+       return GDB_OSABI_WINCE;
+    if (strcmp(osabi_set_val, "go32") == 0)
+       return GDB_OSABI_GO32;
+    if (strcmp(osabi_set_val, "netware") == 0)
+       return GDB_OSABI_NETWARE;
+    if (strcmp(osabi_set_val, "irix") == 0)
+       return GDB_OSABI_IRIX;
+    if (strcmp(osabi_set_val, "lynxos") == 0)
+       return GDB_OSABI_LYNXOS;
+    if (strcmp(osabi_set_val, "arm_eabi_v1") == 0)
+       return GDB_OSABI_ARM_EABI_V1;
+    if (strcmp(osabi_set_val, "arm_eabi_v2") == 0)
+       return GDB_OSABI_ARM_EABI_V2;
+    if (strcmp(osabi_set_val, "arm_apcs") == 0)
+       return GDB_OSABI_ARM_APCS;
+    return GDB_OSABI_UNKNOWN;
+}
+
 const char *
 gdbarch_osabi_name (enum gdb_osabi osabi)
 {
@@ -162,7 +207,13 @@

   match = GDB_OSABI_UNKNOWN;
   match_specific = 0;
-
+
+  if (osabi_set_val != NULL) {
+    match =  gdbarch_osabi_var_set();
+    if (match != GDB_OSABI_UNKNOWN)
+       return match;
+  }
+
   for (sniffer = gdb_osabi_sniffer_list; sniffer != NULL;
        sniffer = sniffer->next)
     {
@@ -373,7 +424,13 @@
 {
   unsigned int elfosabi;
   enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
-
+
+  if (osabi_set_val != NULL) {
+    osabi =  gdbarch_osabi_var_set();
+    if (osabi != GDB_OSABI_UNKNOWN)
+       return osabi;
+  }
+
   elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];

   switch (elfosabi)
@@ -425,13 +482,24 @@
 void
 _initialize_gdb_osabi (void)
 {
+  struct cmd_list_element *c;
+
   if (strcmp (gdb_osabi_names[GDB_OSABI_INVALID], "<invalid>") != 0)
     internal_error
       (__FILE__, __LINE__,
        "_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent");

+  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);
+
   /* Register a generic sniffer for ELF flavoured files.  */
   gdbarch_register_osabi_sniffer (bfd_arch_unknown,
                                  bfd_target_elf_flavour,
                                  generic_elf_osabi_sniffer);
+
 }



-- 
Simon Posnjak
http://klada.dyndns.org


             reply	other threads:[~2002-08-15 21:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-15 14:19 Simon Posnjak [this message]
2002-08-19 15:31 ` Andrew Cagney
2002-08-19 15:40   ` Jason R Thorpe
2002-08-19 16:09     ` Andrew Cagney
2002-08-19 16:19       ` Jason R Thorpe

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=1029446386.30623.13.camel@klada.dyndns.org \
    --to=simon.posnjak@siol.net \
    --cc=gdb-patches@sources.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