summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/AddressRange.cpp
diff options
context:
space:
mode:
authorGreg Clayton <clayborg@gmail.com>2019-05-06 20:01:21 +0000
committerGreg Clayton <clayborg@gmail.com>2019-05-06 20:01:21 +0000
commit8a7779209d93660d2fb68f1f5ebe1d56959495b8 (patch)
tree8e9fd14b056d174e8093583e3ce71769c159fb3b /lldb/source/Core/AddressRange.cpp
parent364ef5db2b23f0aee6e6aa76b338d2210e54a0d7 (diff)
downloadbcm5719-llvm-8a7779209d93660d2fb68f1f5ebe1d56959495b8.tar.gz
bcm5719-llvm-8a7779209d93660d2fb68f1f5ebe1d56959495b8.zip
Include inlined functions when figuring out a contiguous address range
Checking this in for Antonio Afonso: This diff changes the function LineEntry::GetSameLineContiguousAddressRange so that it also includes function calls that were inlined at the same line of code. My motivation is to decrease the step over time of lines that heavly rely on inlined functions. I have multiple examples in the code base I work that makes a step over stop 20 or mote times internally. This can easly had up to step overs that take >500ms which I was able to lower to 25ms with this new strategy. The reason the current code is not extending the address range beyond an inlined function is because when we resolve the symbol at the next address of the line entry we will get the entry line corresponding to where the original code for the inline function lives, making us barely extend the range. This then will end up on a step over having to stop multiple times everytime there's an inlined function. To check if the range is an inlined function at that line I also get the block associated with the next address and check if there is a parent block with a call site at the line we're trying to extend. To check this I created a new function in Block called GetContainingInlinedBlockWithCallSite that does exactly that. I also added a new function to Declaration for convinence of checking file/line named CompareFileAndLine. To avoid potential issues when extending an address range I added an Extend function that extends the range by the AddressRange given as an argument. This function returns true to indicate sucess when the rage was agumented, false otherwise (e.g.: the ranges are not connected). The reason I do is to make sure that we're not just blindly extending complete_line_range by whatever GetByteSize() we got. If for some reason the ranges are not connected or overlap, or even 0, this could be an issue. I also added a unit tests for this change and include the instructions on the test itself on how to generate the yaml file I use for testing. Differential Revision: https://reviews.llvm.org/D61292 llvm-svn: 360071
Diffstat (limited to 'lldb/source/Core/AddressRange.cpp')
-rw-r--r--lldb/source/Core/AddressRange.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp
index f23684047b3..71eec3c1960 100644
--- a/lldb/source/Core/AddressRange.cpp
+++ b/lldb/source/Core/AddressRange.cpp
@@ -122,6 +122,24 @@ bool AddressRange::ContainsLoadAddress(addr_t load_addr, Target *target) const {
return false;
}
+bool AddressRange::Extend(const AddressRange &rhs_range) {
+ addr_t lhs_end_addr = GetBaseAddress().GetFileAddress() + GetByteSize();
+ addr_t rhs_base_addr = rhs_range.GetBaseAddress().GetFileAddress();
+
+ if (!ContainsFileAddress(rhs_range.GetBaseAddress()) &&
+ lhs_end_addr != rhs_base_addr)
+ // The ranges don't intersect at all on the right side of this range.
+ return false;
+
+ addr_t rhs_end_addr = rhs_base_addr + rhs_range.GetByteSize();
+ if (lhs_end_addr >= rhs_end_addr)
+ // The rhs range totally overlaps this one, nothing to add.
+ return false;
+
+ m_byte_size += rhs_end_addr - lhs_end_addr;
+ return true;
+}
+
void AddressRange::Clear() {
m_base_addr.Clear();
m_byte_size = 0;
OpenPOWER on IntegriCloud