* [PATCH 1/2] gdb/dwarf: don't pass lowpc/highpc to dwarf2_ranges_read in cooked_indexer::scan_attributes
@ 2026-03-12 16:32 simon.marchi
2026-03-12 16:32 ` [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read simon.marchi
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
0 siblings, 2 replies; 5+ messages in thread
From: simon.marchi @ 2026-03-12 16:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
From: Simon Marchi <simon.marchi@polymtl.ca>
It's not necessary to pass pointers to those variables
(dwarf2_ranges_read checks then for nullptr), and they are not used.
Remove them.
Change-Id: Id5462d481f209e9546380f52ddeea2eea811f5f3
---
gdb/dwarf2/cooked-indexer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/dwarf2/cooked-indexer.c b/gdb/dwarf2/cooked-indexer.c
index 40f62de80eb4..1848b92e2cab 100644
--- a/gdb/dwarf2/cooked-indexer.c
+++ b/gdb/dwarf2/cooked-indexer.c
@@ -275,8 +275,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
want to add this value. */
ranges_offset += reader->cu ()->gnu_ranges_base;
- unrelocated_addr lowpc, highpc;
- dwarf2_ranges_read (ranges_offset, &lowpc, &highpc, reader->cu (),
+ dwarf2_ranges_read (ranges_offset, nullptr, nullptr,
+ reader->cu (),
m_index_storage->get_addrmap (),
scanning_per_cu, abbrev->tag);
}
base-commit: 1fa846a3d49aa9025359c749965c64e1997d5a25
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read
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
2026-03-12 16:51 ` 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
1 sibling, 1 reply; 5+ messages in thread
From: simon.marchi @ 2026-03-12 16:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gdb/dwarf: don't pass lowpc/highpc to dwarf2_ranges_read in cooked_indexer::scan_attributes
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 ` [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read simon.marchi
@ 2026-03-12 16:45 ` Tom de Vries
2026-03-14 17:35 ` Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2026-03-12 16:45 UTC (permalink / raw)
To: simon.marchi, gdb-patches
On 3/12/26 5:32 PM, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
>
> It's not necessary to pass pointers to those variables
> (dwarf2_ranges_read checks then for nullptr), and they are not used.
Did you mean "as they are not used"?
Anyway, LGTM.
Approved-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
> Remove them.
>
> Change-Id: Id5462d481f209e9546380f52ddeea2eea811f5f3
> ---
> gdb/dwarf2/cooked-indexer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/dwarf2/cooked-indexer.c b/gdb/dwarf2/cooked-indexer.c
> index 40f62de80eb4..1848b92e2cab 100644
> --- a/gdb/dwarf2/cooked-indexer.c
> +++ b/gdb/dwarf2/cooked-indexer.c
> @@ -275,8 +275,8 @@ cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu,
> want to add this value. */
> ranges_offset += reader->cu ()->gnu_ranges_base;
>
> - unrelocated_addr lowpc, highpc;
> - dwarf2_ranges_read (ranges_offset, &lowpc, &highpc, reader->cu (),
> + dwarf2_ranges_read (ranges_offset, nullptr, nullptr,
> + reader->cu (),
> m_index_storage->get_addrmap (),
> scanning_per_cu, abbrev->tag);
> }
>
> base-commit: 1fa846a3d49aa9025359c749965c64e1997d5a25
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read
2026-03-12 16:32 ` [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read simon.marchi
@ 2026-03-12 16:51 ` Tom de Vries
0 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2026-03-12 16:51 UTC (permalink / raw)
To: simon.marchi, gdb-patches
On 3/12/26 5:32 PM, simon.marchi@polymtl.ca wrote:
> 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.
>
Hi,
LGTM.
Approved-By: Tom de Vries <tdevries@suse.de>
Thanks,
- Tom
> 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;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] gdb/dwarf: don't pass lowpc/highpc to dwarf2_ranges_read in cooked_indexer::scan_attributes
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
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2026-03-14 17:35 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
On 2026-03-12 12:45, Tom de Vries wrote:
> On 3/12/26 5:32 PM, simon.marchi@polymtl.ca wrote:
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> It's not necessary to pass pointers to those variables
>> (dwarf2_ranges_read checks then for nullptr), and they are not used.
>
> Did you mean "as they are not used"?
It's not super clear, but I mean:
- dwarf2_ranges_read supports passing nullptr for those parameters
- scan_attributes doesn't really need the values
Since both these statements are true, we can switch to passing nullptr.
>
> Anyway, LGTM.
>
> Approved-By: Tom de Vries <tdevries@suse.de>
Thanks, will push.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-14 17:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/2] gdb/dwarf: rename low_set variable in dwarf2_ranges_read simon.marchi
2026-03-12 16:51 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox