[Lldb-commits] [lldb] [lldb][NFC] Make the target's SectionLoadList private. (PR #113278)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 22 01:28:02 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff dc84337f7b5bb2447e30f3364ebc863e9e04b8be 851ee7a3fd4f1ae294f3e0baaf0944caeadb7d05 --extensions cpp,h -- lldb/include/lldb/Target/Target.h lldb/source/API/SBBreakpoint.cpp lldb/source/Breakpoint/BreakpointLocationList.cpp lldb/source/Commands/CommandObjectDisassemble.cpp lldb/source/Commands/CommandObjectRegister.cpp lldb/source/Commands/CommandObjectSource.cpp lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Core/Address.cpp lldb/source/Core/Disassembler.cpp lldb/source/Core/DumpDataExtractor.cpp lldb/source/Core/FormatEntity.cpp lldb/source/Core/Section.cpp lldb/source/Core/Value.cpp lldb/source/DataFormatters/CXXFunctionPointer.cpp lldb/source/Expression/ObjectFileJIT.cpp lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.cpp lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp lldb/source/Symbol/ObjectFile.cpp lldb/source/Target/ProcessTrace.cpp lldb/source/Target/Target.cpp lldb/source/Target/ThreadPlanStepInRange.cpp lldb/source/Target/ThreadPlanTracer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 5f43b4f506..a1577d2108 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1140,7 +1140,6 @@ public:
Address &pointer_addr,
bool force_live_memory = false);
-
bool SectionLoadListIsEmpty() const;
lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp);
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 22b29b1e8a..74699a101d 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -256,7 +256,7 @@ CommandObjectDisassemble::GetContainingAddressRanges() {
Target &target = GetTarget();
if (!target.SectionLoadListIsEmpty()) {
Address symbol_containing_address;
- if (target.ResolveLoadAddress(m_options.symbol_containing_addr,
+ if (target.ResolveLoadAddress(m_options.symbol_containing_addr,
symbol_containing_address)) {
get_range(symbol_containing_address);
}
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index cb53d7c21b..fbb92e5c63 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -95,7 +95,7 @@ public:
addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
if (reg_addr != LLDB_INVALID_ADDRESS) {
Address so_reg_addr;
- if (exe_ctx.GetTargetRef().ResolveLoadAddress(reg_addr,
+ if (exe_ctx.GetTargetRef().ResolveLoadAddress(reg_addr,
so_reg_addr)) {
strm.PutCString(" ");
so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(),
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 3642d22a9b..b324eb7287 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2974,7 +2974,7 @@ protected:
sect_name);
break;
} else {
- if (target.SetSectionLoadAddress(section_sp,
+ if (target.SetSectionLoadAddress(section_sp,
load_addr))
changed = true;
result.AppendMessageWithFormat(
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 6c4f43ca06..e57a150f86 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -102,7 +102,11 @@ static Address ResolveAddress(Target &target, const Address &addr) {
Address resolved_addr;
// If we weren't passed in a section offset address range, try and resolve
// it to something
- bool is_resolved = target.SectionLoadListIsEmpty() ? target.GetImages().ResolveFileAddress(addr.GetOffset(), resolved_addr) : target.ResolveLoadAddress(addr.GetOffset(), resolved_addr);
+ bool is_resolved =
+ target.SectionLoadListIsEmpty()
+ ? target.GetImages().ResolveFileAddress(addr.GetOffset(),
+ resolved_addr)
+ : target.ResolveLoadAddress(addr.GetOffset(), resolved_addr);
// We weren't able to resolve the address, just treat it as a raw address
if (is_resolved && resolved_addr.IsValid())
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 12a78ffea2..9f628679dc 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -637,8 +637,7 @@ bool SectionList::ContainsSection(user_id_t sect_id) const {
void SectionList::Dump(llvm::raw_ostream &s, unsigned indent, Target *target,
bool show_header, uint32_t depth) const {
- bool target_has_loaded_sections =
- target && !target->SectionLoadListIsEmpty();
+ bool target_has_loaded_sections = target && !target->SectionLoadListIsEmpty();
if (show_header && !m_sections.empty()) {
s.indent(indent);
s << llvm::formatv(
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index 00647e75c3..7a679c893d 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -364,7 +364,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
// memory sections loaded. This allows you to use "target modules
// load" to load your executable and any shared libraries, then
// execute commands where you can look at types in data sections.
- if (!target->SectionLoadListIsEmpty()) {
+ if (!target->SectionLoadListIsEmpty()) {
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (target->ResolveLoadAddress(address, file_so_addr)) {
address_type = eAddressTypeLoad;
diff --git a/lldb/source/Expression/ObjectFileJIT.cpp b/lldb/source/Expression/ObjectFileJIT.cpp
index 224f420787..e4a613551d 100644
--- a/lldb/source/Expression/ObjectFileJIT.cpp
+++ b/lldb/source/Expression/ObjectFileJIT.cpp
@@ -178,7 +178,7 @@ bool ObjectFileJIT::SetLoadAddress(Target &target, lldb::addr_t value,
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp && section_sp->GetFileSize() > 0 &&
!section_sp->IsThreadSpecific()) {
- if (target.SetSectionLoadAddress(section_sp,
+ if (target.SetSectionLoadAddress(section_sp,
section_sp->GetFileAddress() + value))
++num_loaded_sections;
}
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index 25051ec557..643c9653f2 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -103,7 +103,7 @@ void DynamicLoaderStatic::LoadAllImagesAtFileAddresses() {
for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
if (section_sp) {
- if (target.GetSectionLoadAddress(section_sp) !=
+ if (target.GetSectionLoadAddress(section_sp) !=
LLDB_INVALID_ADDRESS) {
no_load_addresses = false;
break;
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
index 60badbbf91..798504a499 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -271,7 +271,7 @@ CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(
Address vtable_first_entry_resolved;
- if (!target.ResolveLoadAddress(vtable_address_first_entry,
+ if (!target.ResolveLoadAddress(vtable_address_first_entry,
vtable_first_entry_resolved))
return optional_info;
@@ -321,7 +321,7 @@ CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo(
// Setup for cases 2, 4 and 5 we have a pointer to a function after the
// vtable. We will use a process of elimination to drop through each case
// and obtain the data we need.
- if (target.ResolveLoadAddress(possible_function_address,
+ if (target.ResolveLoadAddress(possible_function_address,
function_address_resolved)) {
target.GetImages().ResolveSymbolContextForAddress(
function_address_resolved, eSymbolContextEverything, sc);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 0b7d5401e7..2e191002aa 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6238,7 +6238,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
"0x%" PRIx64,
section_sp->GetName().AsCString(),
section_sp->GetFileAddress() + value);
- if (target.SetSectionLoadAddress(section_sp,
+ if (target.SetSectionLoadAddress(section_sp,
section_sp->GetFileAddress() + value,
warn_multiple))
++num_loaded_sections;
@@ -6261,7 +6261,7 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
"ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
"0x%" PRIx64,
section_sp->GetName().AsCString(), section_load_addr);
- if (target.SetSectionLoadAddress(section_sp, section_load_addr,
+ if (target.SetSectionLoadAddress(section_sp, section_load_addr,
warn_multiple))
++num_loaded_sections;
}
diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
index 295c710c90..91829e9952 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp
@@ -263,8 +263,7 @@ BuildModulesSection(Process &process, FileSpec directory) {
lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
Address base_addr(objfile->GetBaseAddress());
- if (base_addr.IsValid() &&
- !process.GetTarget().SectionLoadListIsEmpty())
+ if (base_addr.IsValid() && !process.GetTarget().SectionLoadListIsEmpty())
load_addr = base_addr.GetLoadAddress(&process.GetTarget());
if (load_addr == LLDB_INVALID_ADDRESS)
``````````
</details>
https://github.com/llvm/llvm-project/pull/113278
More information about the lldb-commits
mailing list