Patchwork [pushed/ob] Apply "Convert observers to C++" edit to gdbarch.sh (Re: [PATCH] infrun: step through indirect branch thunks)

login
register
mail settings
Submitter Pedro Alves
Date April 9, 2018, 2:42 p.m.
Message ID <944991b6-f949-4c3f-22d3-dffb2dd84e67@redhat.com>
Download mbox | patch
Permalink /patch/26655/
State New
Headers show

Comments

Pedro Alves - April 9, 2018, 2:42 p.m.
On 04/09/2018 03:19 PM, Metzger, Markus T wrote:

> While regenerating gdbarch, I noticed that it generated the following
> unrelated changes:
> 
> --- gdbarch.c   2018-04-09 14:56:08.976814000 +0200
> +++ new-gdbarch.c       2018-04-09 14:57:33.914668000 +0200
> @@ -44,7 +44,7 @@
>  #include "reggroups.h"
>  #include "osabi.h"
>  #include "gdb_obstack.h"
> -#include "observable.h"
> +#include "observer.h"
>  #include "regcache.h"
>  #include "objfiles.h"
>  #include "auxv.h"
> @@ -5480,7 +5480,7 @@
>    gdb_assert (new_gdbarch != NULL);
>    gdb_assert (new_gdbarch->initialized_p);
>    current_inferior ()->gdbarch = new_gdbarch;
> -  gdb::observers::architecture_changed.notify (new_gdbarch);
> +  observer_notify_architecture_changed (new_gdbarch);
>    registers_changed ();
>  }
> 
> , which result in a build error:
> 
> .../gdb/gdbarch.c:47:10: fatal error: observer.h: No such file or directory
>  #include "observer.h"
>           ^~~~~~~~~~~~
> compilation terminated.
> 
> I excluded those from my patch.

We should just fix that first.  Done now.

From 0bee6dd4aa42b928c2a7a496596490b694e5722b Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 9 Apr 2018 15:34:48 +0100
Subject: [PATCH] Apply "Convert observers to C++" edit to gdbarch.sh

Regenerating gdbarch.c results in:

  --- gdbarch.c   2018-03-26 23:18:52.905548891 +0100
  +++ new-gdbarch.c       2018-04-09 15:32:30.006712207 +0100
  @@ -44,7 +44,7 @@
   #include "reggroups.h"
   #include "osabi.h"
   #include "gdb_obstack.h"
  -#include "observable.h"
  +#include "observer.h"
   #include "regcache.h"
   #include "objfiles.h"
   #include "auxv.h"
  @@ -5457,7 +5457,7 @@
     gdb_assert (new_gdbarch != NULL);
     gdb_assert (new_gdbarch->initialized_p);
     current_inferior ()->gdbarch = new_gdbarch;
  -  gdb::observers::architecture_changed.notify (new_gdbarch);
  +  observer_notify_architecture_changed (new_gdbarch);
     registers_changed ();
   }


Clearly commit 76727919ceb5 ("Convert observers to C++") edited
gdbarch.c directly instead of gdbarch.sh.  This fixes it.

gdb/ChangeLog:
2018-04-09  Pedro Alves  <palves@redhat.com>

	* gdbarch.sh: Include "observable.h" instead of "observer.h".
	(set_target_gdbarch): Call
	gdb::observers::architecture_changed.notify instead of
	observer_notify_architecture_changed.
---
 gdb/ChangeLog  | 7 +++++++
 gdb/gdbarch.sh | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc95d7632fd..71e175fe993 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@ 
+2018-04-09  Pedro Alves  <palves@redhat.com>
+
+	* gdbarch.sh: Include "observable.h" instead of "observer.h".
+	(set_target_gdbarch): Call
+	gdb::observers::architecture_changed.notify instead of
+	observer_notify_architecture_changed.
+
 2018-04-07  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* tracepoint.c (struct current_traceframe_cleanup): Remove.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 33dfa6b349d..092302993a7 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1644,7 +1644,7 @@  cat <<EOF
 #include "reggroups.h"
 #include "osabi.h"
 #include "gdb_obstack.h"
-#include "observer.h"
+#include "observable.h"
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
@@ -2506,7 +2506,7 @@  set_target_gdbarch (struct gdbarch *new_gdbarch)
   gdb_assert (new_gdbarch != NULL);
   gdb_assert (new_gdbarch->initialized_p);
   current_inferior ()->gdbarch = new_gdbarch;
-  observer_notify_architecture_changed (new_gdbarch);
+  gdb::observers::architecture_changed.notify (new_gdbarch);
   registers_changed ();
 }