Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read
Date: Thu, 12 Mar 2026 12:32:03 -0400	[thread overview]
Message-ID: <20260312163213.2650909-2-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20260312163213.2650909-1-simon.marchi@polymtl.ca>

From: Simon Marchi <simon.marchi@polymtl.ca>

Rename low_set to low_high_set, to reflect what it really means.

Also, change some manual min/max so use std::min/std::max, I think it
makes the intent clearer.

Change-Id: I9ca81be915962e704becabe78c39b95e0abf561b
---
 gdb/dwarf2/read.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 5e310afc3f92..495b519faed4 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8717,7 +8717,7 @@ dwarf2_ranges_read (unsigned offset, unrelocated_addr *low_return,
 		    unrelocated_addr *high_return, struct dwarf2_cu *cu,
 		    addrmap_mutable *map, void *datum, dwarf_tag tag)
 {
-  bool low_set = false;
+  bool low_high_set = false;
   unrelocated_addr low = {};
   unrelocated_addr high = {};
   bool retval = dwarf2_ranges_process (offset, cu, tag,
@@ -8735,29 +8735,26 @@ dwarf2_ranges_read (unsigned offset, unrelocated_addr *low_return,
 	 segment of consecutive addresses.  We should have a
 	 data structure for discontiguous block ranges
 	 instead.  */
-      if (!low_set)
+      if (!low_high_set)
 	{
 	  low = range_beginning;
 	  high = range_end;
-	  low_set = true;
+	  low_high_set = true;
 	}
       else
 	{
-	  if (range_beginning < low)
-	    low = range_beginning;
-
-	  if (range_end > high)
-	    high = range_end;
+	  low = std::min (low, range_beginning);
+	  high = std::max (high, range_end);
 	}
     });
 
   if (!retval)
     return false;
 
-  if (!low_set)
+  if (!low_high_set)
     {
       /* If the first entry is an end-of-list marker, the range
-       describes an empty scope, i.e. no instructions.  */
+	 describes an empty scope, i.e. no instructions.  */
       return false;
     }
 
-- 
2.53.0


  reply	other threads:[~2026-03-12 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 16:32 [PATCH 1/2] gdb/dwarf: don't pass lowpc/highpc to dwarf2_ranges_read in cooked_indexer::scan_attributes simon.marchi
2026-03-12 16:32 ` simon.marchi [this message]
2026-03-12 16:51   ` [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read Tom de Vries
2026-03-12 16:45 ` [PATCH 1/2] gdb/dwarf: don't pass lowpc/highpc to dwarf2_ranges_read in cooked_indexer::scan_attributes Tom de Vries
2026-03-14 17:35   ` Simon Marchi

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=20260312163213.2650909-2-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --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