Fix build without libexpat (Re: [PATCH 1/4] Merge remote thread listing methods)

Message ID 5440ECBC.5060202@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves Oct. 17, 2014, 10:17 a.m. UTC
  Hi Jiong,

>    looks like this change break arm native build on chrome book.
> 
>    clear_threads_listing_context only exist when HAVE_LIBEXPACT defined.

Thanks, fixed with the patch below.  Though you should really link
with libexpat.  gdb processes built-in xml files even when
native debugging.

----
From 80134cf5b3ca1f75a96af1856fdaad29ad1f57aa Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Fri, 17 Oct 2014 11:05:06 +0100
Subject: [PATCH] Fix build without libexpat

clear_threads_listing_context is used for thread listing methods other
than the xml based, but it's only defined when HAVE_LIBEXPAT is defined.

gdb/
2014-10-17  Pedro Alves  <palves@redhat.com>

	* remote.c (clear_threads_listing_context): Move higher up, out of
	the HAVE_LIBEXPAT guard.
---
 gdb/ChangeLog |  5 +++++
 gdb/remote.c  | 30 +++++++++++++++---------------
 2 files changed, 20 insertions(+), 15 deletions(-)
  

Comments

Jiong Wang Oct. 17, 2014, 10:21 a.m. UTC | #1
On 17/10/14 11:17, Pedro Alves wrote:
> Hi Jiong,
>
>>     looks like this change break arm native build on chrome book.
>>
>>     clear_threads_listing_context only exist when HAVE_LIBEXPACT defined.
> Thanks, fixed with the patch below.  Though you should really link
> with libexpat.  gdb processes built-in xml files even when
> native debugging.

I see, great, thanks!

Regards,
Jiong

>
> ----
> >From 80134cf5b3ca1f75a96af1856fdaad29ad1f57aa Mon Sep 17 00:00:00 2001
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 17 Oct 2014 11:05:06 +0100
> Subject: [PATCH] Fix build without libexpat
>
> clear_threads_listing_context is used for thread listing methods other
> than the xml based, but it's only defined when HAVE_LIBEXPAT is defined.
>
> gdb/
> 2014-10-17  Pedro Alves  <palves@redhat.com>
>
> 	* remote.c (clear_threads_listing_context): Move higher up, out of
> 	the HAVE_LIBEXPAT guard.
> ---
>   gdb/ChangeLog |  5 +++++
>   gdb/remote.c  | 30 +++++++++++++++---------------
>   2 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 62d1d06..1ea76a5 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2014-10-17  Pedro Alves  <palves@redhat.com>
> +
> +	* remote.c (clear_threads_listing_context): Move higher up, out of
> +	the HAVE_LIBEXPAT guard.
> +
>   2014-10-16  Tristan Gingold  <gingold@adacore.com>
>   
>   	* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers)
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 98d3f2a..20f2988 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -2559,6 +2559,21 @@ struct threads_listing_context
>     VEC (thread_item_t) *items;
>   };
>   
> +/* Discard the contents of the constructed thread listing context.  */
> +
> +static void
> +clear_threads_listing_context (void *p)
> +{
> +  struct threads_listing_context *context = p;
> +  int i;
> +  struct thread_item *item;
> +
> +  for (i = 0; VEC_iterate (thread_item_t, context->items, i, item); ++i)
> +    xfree (item->extra);
> +
> +  VEC_free (thread_item_t, context->items);
> +}
> +
>   static int
>   remote_newthread_step (threadref *ref, void *data)
>   {
> @@ -2664,21 +2679,6 @@ const struct gdb_xml_element threads_elements[] = {
>     { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
>   };
>   
> -/* Discard the contents of the constructed thread info context.  */
> -
> -static void
> -clear_threads_listing_context (void *p)
> -{
> -  struct threads_listing_context *context = p;
> -  int i;
> -  struct thread_item *item;
> -
> -  for (i = 0; VEC_iterate (thread_item_t, context->items, i, item); ++i)
> -    xfree (item->extra);
> -
> -  VEC_free (thread_item_t, context->items);
> -}
> -
>   #endif
>   
>   /* List remote threads using qXfer:threads:read.  */
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 62d1d06..1ea76a5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2014-10-17  Pedro Alves  <palves@redhat.com>
+
+	* remote.c (clear_threads_listing_context): Move higher up, out of
+	the HAVE_LIBEXPAT guard.
+
 2014-10-16  Tristan Gingold  <gingold@adacore.com>
 
 	* i386-darwin-nat.c (i386_darwin_fetch_inferior_registers)
diff --git a/gdb/remote.c b/gdb/remote.c
index 98d3f2a..20f2988 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2559,6 +2559,21 @@  struct threads_listing_context
   VEC (thread_item_t) *items;
 };
 
+/* Discard the contents of the constructed thread listing context.  */
+
+static void
+clear_threads_listing_context (void *p)
+{
+  struct threads_listing_context *context = p;
+  int i;
+  struct thread_item *item;
+
+  for (i = 0; VEC_iterate (thread_item_t, context->items, i, item); ++i)
+    xfree (item->extra);
+
+  VEC_free (thread_item_t, context->items);
+}
+
 static int
 remote_newthread_step (threadref *ref, void *data)
 {
@@ -2664,21 +2679,6 @@  const struct gdb_xml_element threads_elements[] = {
   { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
 };
 
-/* Discard the contents of the constructed thread info context.  */
-
-static void
-clear_threads_listing_context (void *p)
-{
-  struct threads_listing_context *context = p;
-  int i;
-  struct thread_item *item;
-
-  for (i = 0; VEC_iterate (thread_item_t, context->items, i, item); ++i)
-    xfree (item->extra);
-
-  VEC_free (thread_item_t, context->items);
-}
-
 #endif
 
 /* List remote threads using qXfer:threads:read.  */