gdb: convert address_in_mem_range to mem_range::contains
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
Commit Message
Replace the global function address_in_mem_range with the member
function mem_range::contains. The implementation of the function
doesn't change.
There should be no user visible changes after this commit.
---
gdb/corelow.c | 4 ++--
gdb/memrange.c | 8 ++++----
gdb/memrange.h | 8 +++-----
gdb/solib-svr4.c | 2 +-
4 files changed, 10 insertions(+), 12 deletions(-)
base-commit: 868883583e7520ff1bd99fcb224d2b33a990edff
Comments
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> Replace the global function address_in_mem_range with the member
Andrew> function mem_range::contains. The implementation of the function
Andrew> doesn't change.
Andrew> There should be no user visible changes after this commit.
Looks reasonable to me.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
Tom Tromey <tom@tromey.com> writes:
>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> Replace the global function address_in_mem_range with the member
> Andrew> function mem_range::contains. The implementation of the function
> Andrew> doesn't change.
>
> Andrew> There should be no user visible changes after this commit.
>
> Looks reasonable to me.
> Approved-By: Tom Tromey <tom@tromey.com>
Pushed.
Thanks,
Andrew
@@ -994,9 +994,9 @@ core_target::xfer_memory_via_mappings (gdb_byte *readbuf,
for (const auto &mr : m_core_unavailable_mappings)
{
- if (address_in_mem_range (memaddr, &mr))
+ if (mr.contains (memaddr))
{
- if (!address_in_mem_range (memend, &mr))
+ if (!mr.contains (memend))
len = mr.start + mr.length - memaddr;
xfer_status = this->beneath ()->xfer_partial (TARGET_OBJECT_MEMORY,
@@ -33,11 +33,11 @@ mem_ranges_overlap (CORE_ADDR start1, int len1,
/* See memrange.h. */
-int
-address_in_mem_range (CORE_ADDR address, const struct mem_range *r)
+bool
+mem_range::contains (CORE_ADDR address) const
{
- return (r->start <= address
- && (address - r->start) < r->length);
+ return (this->start <= address
+ && (address - this->start) < this->length);
}
void
@@ -41,6 +41,9 @@ struct mem_range
&& this->length == other.length);
}
+ /* Returns true if ADDR is in this mem_range. */
+ bool contains (CORE_ADDR addr) const;
+
/* Lowest address in the range. */
CORE_ADDR start;
@@ -54,11 +57,6 @@ struct mem_range
extern int mem_ranges_overlap (CORE_ADDR start1, int len1,
CORE_ADDR start2, int len2);
-/* Returns true if ADDR is in RANGE. */
-
-extern int address_in_mem_range (CORE_ADDR addr,
- const struct mem_range *range);
-
/* Sort ranges by start address, then coalesce contiguous or
overlapping ranges. */
@@ -1475,7 +1475,7 @@ svr4_current_sos ()
auto *li = gdb::checked_static_cast<lm_info_svr4 *> (so->lm_info.get ());
- if (address_in_mem_range (li->l_ld, &vsyscall_range))
+ if (vsyscall_range.contains (li->l_ld))
{
auto next = sos.erase (so);
delete &*so;