Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PUSHED/OBVIOUS] Make extern declaration of dwarf_always_disassemble correct
@ 2019-09-18  4:56 Christian Biesinger via gdb-patches
  2019-09-18 11:17 ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-09-18  4:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: Christian Biesinger

This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
dwarf2loc.c has an extern definition for dwarf_always_disassemble
that I missed. This patch updates it from int to bool to match
the definition in dwarf2read.c.

gdb/ChangeLog:

2019-09-18  Christian Biesinger  <cbiesinger@google.com>

	* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
	to bool to match definition in dwarf2read.c.
---
 gdb/ChangeLog   | 5 +++++
 gdb/dwarf2loc.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8cb5bfeeb98..39fcac7a04e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-18  Christian Biesinger  <cbiesinger@google.com>
+
+	* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
+	to bool to match definition in dwarf2read.c.
+
 2019-09-17  Christian Biesinger  <cbiesinger@google.com>
 
 	* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 63643cb45d5..29fccae5944 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -46,7 +46,7 @@
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/byte-vector.h"
 
-extern int dwarf_always_disassemble;
+extern bool dwarf_always_disassemble;
 
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,
-- 
2.23.0.237.gc6a4ce50a0-goog


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

* Re: [PUSHED/OBVIOUS] Make extern declaration of dwarf_always_disassemble correct
  2019-09-18  4:56 [PUSHED/OBVIOUS] Make extern declaration of dwarf_always_disassemble correct Christian Biesinger via gdb-patches
@ 2019-09-18 11:17 ` Simon Marchi
  2019-09-19  4:31   ` [PATCH] Declare dwarf_always_disassemble in dwarf2read.h Christian Biesinger via gdb-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2019-09-18 11:17 UTC (permalink / raw)
  To: Christian Biesinger, gdb-patches

On 2019-09-18 12:56 a.m., Christian Biesinger via gdb-patches wrote:
> This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
> dwarf2loc.c has an extern definition for dwarf_always_disassemble
> that I missed. This patch updates it from int to bool to match
> the definition in dwarf2read.c.

Hi Christian,

I think we should take that opportunity to fix the problem in a way
that would have prevented this mistake and make things cleaner.

Can you try to move the declaration of dwarf_always_disassemble to dwarf2read.h,
remove the declaration from dwarf2loc.c, and make dwarf2loc.c include dwarf2read.h?
I think it's just for historical reasons that this variable has a local declaration
in dwarf2loc.c (dwarf2read.h exists since not so long ago), but as we saw it's a
bit dangerous to do it this way.

Simon


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

* [PATCH] Declare dwarf_always_disassemble in dwarf2read.h
  2019-09-18 11:17 ` Simon Marchi
@ 2019-09-19  4:31   ` Christian Biesinger via gdb-patches
  2019-09-19 11:01     ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-09-19  4:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Christian Biesinger

[Simon, how's this? Compiles fine.]

And remove the declaration from dwarf2loc.c, for better typesafety.

gdb/ChangeLog:

2019-09-19  Christian Biesinger  <cbiesinger@google.com>

	* dwarf2loc.c: Remove extern declaration of dwarf_always_disassemble.
	* dwarf2read.h: Declare dwarf_always_disassemble.
---
 gdb/dwarf2loc.c  | 2 --
 gdb/dwarf2read.h | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 29fccae5944..c8ba0290a02 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -46,8 +46,6 @@
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/byte-vector.h"
 
-extern bool dwarf_always_disassemble;
-
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,
 						    const gdb_byte *data,
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index 8939f97af53..e9b946247b0 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -33,6 +33,8 @@ extern struct cmd_list_element *show_dwarf_cmdlist;
 typedef struct dwarf2_per_cu_data *dwarf2_per_cu_ptr;
 DEF_VEC_P (dwarf2_per_cu_ptr);
 
+extern bool dwarf_always_disassemble;
+
 /* A descriptor for dwarf sections.
 
    S.ASECTION, SIZE are typically initialized when the objfile is first
-- 
2.23.0.351.gc4317032e6-goog


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

* Re: [PATCH] Declare dwarf_always_disassemble in dwarf2read.h
  2019-09-19  4:31   ` [PATCH] Declare dwarf_always_disassemble in dwarf2read.h Christian Biesinger via gdb-patches
@ 2019-09-19 11:01     ` Simon Marchi
  2019-09-20  0:15       ` Christian Biesinger via gdb-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2019-09-19 11:01 UTC (permalink / raw)
  To: Christian Biesinger, gdb-patches

On 2019-09-19 12:31 a.m., Christian Biesinger via gdb-patches wrote:
> [Simon, how's this? Compiles fine.]
> 
> And remove the declaration from dwarf2loc.c, for better typesafety.

LGTM, thanks,

Simon


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

* Re: [PATCH] Declare dwarf_always_disassemble in dwarf2read.h
  2019-09-19 11:01     ` Simon Marchi
@ 2019-09-20  0:15       ` Christian Biesinger via gdb-patches
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Biesinger via gdb-patches @ 2019-09-20  0:15 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On Thu, Sep 19, 2019 at 8:01 PM Simon Marchi <simark@simark.ca> wrote:
>
> On 2019-09-19 12:31 a.m., Christian Biesinger via gdb-patches wrote:
> > [Simon, how's this? Compiles fine.]
> >
> > And remove the declaration from dwarf2loc.c, for better typesafety.
>
> LGTM, thanks,

Thanks, pushed.

To ssh://sourceware.org/git/binutils-gdb.git
   956bafb0de0..e86f08d28f4  HEAD -> master

Christian


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

end of thread, other threads:[~2019-09-20  0:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18  4:56 [PUSHED/OBVIOUS] Make extern declaration of dwarf_always_disassemble correct Christian Biesinger via gdb-patches
2019-09-18 11:17 ` Simon Marchi
2019-09-19  4:31   ` [PATCH] Declare dwarf_always_disassemble in dwarf2read.h Christian Biesinger via gdb-patches
2019-09-19 11:01     ` Simon Marchi
2019-09-20  0:15       ` Christian Biesinger via gdb-patches

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