Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Generate set_tdesc_osabi for valid OSABI
@ 2010-02-04 15:49 H.J. Lu
  2010-02-04 16:04 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2010-02-04 15:49 UTC (permalink / raw)
  To: GDB

We don't call set_tdesc_osabi even if there is

<osabi>GNU/Linux</osabi>

in target xml file.  This patch adds it. OK to install?

Thanks.


H.J.
---
2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	* target-descriptions.c (maint_print_c_tdesc_cmd): Generate
	set_tdesc_osabi for valid OSABI.

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 720f0c7..c07173a 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1427,6 +1427,15 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
       printf_unfiltered ("\n");
     }
 
+  if (tdesc_osabi (tdesc) > GDB_OSABI_UNKNOWN
+      && tdesc_osabi (tdesc) < GDB_OSABI_INVALID)
+    {
+      printf_unfiltered
+	("  set_tdesc_osabi (result, (enum gdb_osabi) %d);\n",
+	 (int) tdesc_osabi (tdesc));
+      printf_unfiltered ("\n");
+    }
+
   for (ix = 0; VEC_iterate (arch_p, tdesc->compatible, ix, compatible);
        ix++)
     {


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

* Re: PATCH: Generate set_tdesc_osabi for valid OSABI
  2010-02-04 15:49 PATCH: Generate set_tdesc_osabi for valid OSABI H.J. Lu
@ 2010-02-04 16:04 ` Daniel Jacobowitz
  2010-02-04 16:55   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2010-02-04 16:04 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB

On Thu, Feb 04, 2010 at 07:49:10AM -0800, H.J. Lu wrote:
> 2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* target-descriptions.c (maint_print_c_tdesc_cmd): Generate
> 	set_tdesc_osabi for valid OSABI.

This patch would require regenerating the board files after changing
the enum.  If we have to hard-code the value, there should be a
warning to only add new items to the end of the enum unless
regenerating the files.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: PATCH: Generate set_tdesc_osabi for valid OSABI
  2010-02-04 16:04 ` Daniel Jacobowitz
@ 2010-02-04 16:55   ` H.J. Lu
  2010-02-04 17:06     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2010-02-04 16:55 UTC (permalink / raw)
  To: GDB

[-- Attachment #1: Type: text/plain, Size: 620 bytes --]

On Thu, Feb 4, 2010 at 8:04 AM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> On Thu, Feb 04, 2010 at 07:49:10AM -0800, H.J. Lu wrote:
>> 2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * target-descriptions.c (maint_print_c_tdesc_cmd): Generate
>>       set_tdesc_osabi for valid OSABI.
>
> This patch would require regenerating the board files after changing
> the enum.  If we have to hard-code the value, there should be a
> warning to only add new items to the end of the enum unless
> regenerating the files.
>

Good point. How about using OSABI string instead?

Thanks.


-- 
H.J.

[-- Attachment #2: gdb-tdesc-2.patch --]
[-- Type: text/plain, Size: 1336 bytes --]

2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>

	* target-descriptions.c: Include "osabi.h".
	(maint_print_c_tdesc_cmd): Generate set_tdesc_osabi for valid
	OSABI.

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 720f0c7..22371ed 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -29,6 +29,7 @@
 #include "vec.h"
 #include "xml-support.h"
 #include "xml-tdesc.h"
+#include "osabi.h"
 
 #include "gdb_assert.h"
 #include "gdb_obstack.h"
@@ -1406,6 +1407,7 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
   printf_unfiltered ("/* THIS FILE IS GENERATED.  Original: %s */\n\n",
 		     filename);
   printf_unfiltered ("#include \"defs.h\"\n");
+  printf_unfiltered ("#include \"osabi.h\"\n");
   printf_unfiltered ("#include \"target-descriptions.h\"\n");
   printf_unfiltered ("\n");
 
@@ -1427,6 +1429,15 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
       printf_unfiltered ("\n");
     }
 
+  if (tdesc_osabi (tdesc) > GDB_OSABI_UNKNOWN
+      && tdesc_osabi (tdesc) < GDB_OSABI_INVALID)
+    {
+      printf_unfiltered
+	("  set_tdesc_osabi (result, osabi_from_tdesc_string (\"%s\"));\n",
+	 gdbarch_osabi_name (tdesc_osabi (tdesc)));
+      printf_unfiltered ("\n");
+    }
+
   for (ix = 0; VEC_iterate (arch_p, tdesc->compatible, ix, compatible);
        ix++)
     {

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

* Re: PATCH: Generate set_tdesc_osabi for valid OSABI
  2010-02-04 16:55   ` H.J. Lu
@ 2010-02-04 17:06     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2010-02-04 17:06 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GDB

On Thu, Feb 04, 2010 at 08:54:59AM -0800, H.J. Lu wrote:
> On Thu, Feb 4, 2010 at 8:04 AM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
> > On Thu, Feb 04, 2010 at 07:49:10AM -0800, H.J. Lu wrote:
> >> 2010-02-04  H.J. Lu  <hongjiu.lu@intel.com>
> >>
> >>       * target-descriptions.c (maint_print_c_tdesc_cmd): Generate
> >>       set_tdesc_osabi for valid OSABI.
> >
> > This patch would require regenerating the board files after changing
> > the enum.  If we have to hard-code the value, there should be a
> > warning to only add new items to the end of the enum unless
> > regenerating the files.
> >
> 
> Good point. How about using OSABI string instead?

Nice trick.  Yes, this is fine.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2010-02-04 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-04 15:49 PATCH: Generate set_tdesc_osabi for valid OSABI H.J. Lu
2010-02-04 16:04 ` Daniel Jacobowitz
2010-02-04 16:55   ` H.J. Lu
2010-02-04 17:06     ` Daniel Jacobowitz

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