public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/6] Change value::m_stack to bool
Date: Tue, 14 Feb 2023 13:23:34 -0700	[thread overview]
Message-ID: <20230214-submit-more-value-stuff-v1-4-2fb85efbaa72@tromey.com> (raw)
In-Reply-To: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com>

This changes value::m_stack to be a bool and updates the various uses.
---
 gdb/dwarf2/expr.c  |  2 +-
 gdb/frame-unwind.c |  2 +-
 gdb/valops.c       |  2 +-
 gdb/value.c        |  2 +-
 gdb/value.h        | 10 +++++-----
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 760c5c4b0d0..3f040e7b2d3 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -1005,7 +1005,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
 	    retval = value_at_lazy (subobj_type,
 				    address + subobj_offset);
 	    if (in_stack_memory)
-	      retval->set_stack (1);
+	      retval->set_stack (true);
 	  }
 	  break;
 
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index e5f8dc639e3..a3673dde77a 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -289,7 +289,7 @@ frame_unwind_got_memory (frame_info_ptr frame, int regnum, CORE_ADDR addr)
   struct gdbarch *gdbarch = frame_unwind_arch (frame);
   struct value *v = value_at_lazy (register_type (gdbarch, regnum), addr);
 
-  v->set_stack (1);
+  v->set_stack (true);
   return v;
 }
 
diff --git a/gdb/valops.c b/gdb/valops.c
index 90f7b8c5532..3a1b14c3d44 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1041,7 +1041,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
 
 void
 read_value_memory (struct value *val, LONGEST bit_offset,
-		   int stack, CORE_ADDR memaddr,
+		   bool stack, CORE_ADDR memaddr,
 		   gdb_byte *buffer, size_t length)
 {
   ULONGEST xfered_total = 0;
diff --git a/gdb/value.c b/gdb/value.c
index 855354f542f..6a8c12823c4 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3743,7 +3743,7 @@ value::fetch_lazy_memory ()
   gdb_assert (len >= 0);
 
   if (len > 0)
-    read_value_memory (this, 0, stack (), addr,
+    read_value_memory (this, false, stack (), addr,
 		       contents_all_raw ().data (), len);
 }
 
diff --git a/gdb/value.h b/gdb/value.h
index 41327ebe3b8..4cb6fac4104 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -135,7 +135,7 @@ struct value
     : m_modifiable (true),
       m_lazy (true),
       m_initialized (true),
-      m_stack (0),
+      m_stack (false),
       m_is_zero (false),
       m_in_history (false),
       m_type (type_),
@@ -314,10 +314,10 @@ struct value
 
   void set_enclosing_type (struct type *new_type);
 
-  int stack () const
+  bool stack () const
   { return m_stack; }
 
-  void set_stack (int val)
+  void set_stack (bool val)
   { m_stack = val; }
 
   /* If this value is lval_computed, return its lval_funcs
@@ -642,7 +642,7 @@ struct value
 
   /* If value is from the stack.  If this is set, read_stack will be
      used instead of read_memory to enable extra caching.  */
-  unsigned int m_stack : 1;
+  bool m_stack : 1;
 
   /* True if this is a zero value, created by 'value::zero'; false
      otherwise.  */
@@ -1000,7 +1000,7 @@ extern struct value *coerce_array (struct value *value);
    whether the memory is known to be stack memory.  */
 
 extern void read_value_memory (struct value *val, LONGEST bit_offset,
-			       int stack, CORE_ADDR memaddr,
+			       bool stack, CORE_ADDR memaddr,
 			       gdb_byte *buffer, size_t length);
 
 /* Cast SCALAR_VALUE to the element type of VECTOR_TYPE, then replicate

-- 
2.39.1


  parent reply	other threads:[~2023-02-14 20:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 20:23 [PATCH 0/6] Use bool in value Tom Tromey
2023-02-14 20:23 ` [PATCH 1/6] Change value::m_modifiable to bool Tom Tromey
2023-02-21 14:36   ` Alexandra Petlanova Hajkova
2023-02-14 20:23 ` [PATCH 2/6] Change value::m_lazy " Tom Tromey
2023-02-15 11:53   ` Bruno Larsen
2023-02-15 21:52     ` Tom Tromey
2023-02-14 20:23 ` [PATCH 3/6] Change value::m_initialized " Tom Tromey
2023-02-21 15:10   ` Alexandra Petlanova Hajkova
2023-02-14 20:23 ` Tom Tromey [this message]
2023-02-21 15:30   ` [PATCH 4/6] Change value::m_stack " Alexandra Petlanova Hajkova
2023-02-14 20:23 ` [PATCH 5/6] Have value::bits_synthetic_pointer return bool Tom Tromey
2023-02-14 20:23 ` [PATCH 6/6] Return bool from more value methods Tom Tromey
2023-02-15 12:22 ` [PATCH 0/6] Use bool in value Bruno Larsen
2023-02-15 21:54   ` Tom Tromey

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=20230214-submit-more-value-stuff-v1-4-2fb85efbaa72@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).