[Lldb-commits] [lldb] [lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (PR #67106)

via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 22 02:38:46 PDT 2023


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 3f78d6ab146874d20144f9f5fcbb894931279c7d dc15a7dc299e36930fa52405a4137c184e252305 -- lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.h lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
index 9712da3ecdc8..d5eb891f0060 100644
--- a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -67,7 +67,8 @@ static bool is_kmod(Module *module) {
   if (!module->GetObjectFile())
     return false;
   ObjectFile *objfile = module->GetObjectFile();
-  if (objfile->GetType() != ObjectFile::eTypeObjectFile && objfile->GetType() != ObjectFile::eTypeSharedLibrary)
+  if (objfile->GetType() != ObjectFile::eTypeObjectFile &&
+      objfile->GetType() != ObjectFile::eTypeSharedLibrary)
     return false;
 
   return true;
@@ -236,16 +237,14 @@ lldb_private::UUID DynamicLoaderFreeBSDKernel::CheckForKernelImageAtAddress(
 }
 
 void DynamicLoaderFreeBSDKernel::DebuggerInit(
-    lldb_private::Debugger &debugger) {
-}
+    lldb_private::Debugger &debugger) {}
 
 DynamicLoaderFreeBSDKernel::DynamicLoaderFreeBSDKernel(Process *process,
                                                        addr_t kernel_address)
-  : DynamicLoader(process), m_process(process),
-    m_linker_file_list_struct_addr(LLDB_INVALID_ADDRESS),
-    m_linker_file_head_addr(LLDB_INVALID_ADDRESS),
-    m_kernel_load_address(kernel_address),
-    m_mutex() {
+    : DynamicLoader(process), m_process(process),
+      m_linker_file_list_struct_addr(LLDB_INVALID_ADDRESS),
+      m_linker_file_head_addr(LLDB_INVALID_ADDRESS),
+      m_kernel_load_address(kernel_address), m_mutex() {
   process->SetCanRunCode(false);
 }
 
@@ -379,10 +378,10 @@ bool DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(
     }
   }
 
-  // If this file is relocatable kernel module(x86_64), adjust it's section(PT_LOAD segment) and return
-  // Because the kernel module's load address is the text section.
-  // lldb cannot create full memory module upon relocatable file
-  // So what we do is to set the load address only.
+  // If this file is relocatable kernel module(x86_64), adjust it's
+  // section(PT_LOAD segment) and return Because the kernel module's load
+  // address is the text section. lldb cannot create full memory module upon
+  // relocatable file So what we do is to set the load address only.
   if (is_kmod(m_module_sp.get()) && is_reloc(m_module_sp.get())) {
     m_stop_id = process->GetStopID();
     bool changed;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 9c4243e358c6..ef9b123b78c2 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -940,7 +940,7 @@ Address ObjectFileELF::GetBaseAddress() {
          I != m_section_headers.end(); ++I) {
       const ELFSectionHeaderInfo &header = *I;
       if (header.sh_flags & SHF_ALLOC)
-	return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
+        return Address(GetSectionList()->FindSectionByID(SectionIndex(I)), 0);
     }
     return LLDB_INVALID_ADDRESS;
   }
@@ -1777,7 +1777,8 @@ class VMAddressProvider {
 
     // When this is a debug file for relocatable file, the address is all zero
     if ((ObjectType == ObjectFile::Type::eTypeObjectFile ||
-	 (ObjectType == ObjectFile::Type::eTypeDebugInfo && H.sh_addr == 0)) && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
+         (ObjectType == ObjectFile::Type::eTypeDebugInfo && H.sh_addr == 0)) &&
+        Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
       NextVMAddress =
           llvm::alignTo(NextVMAddress, std::max<addr_t>(H.sh_addralign, 1));
       Address = NextVMAddress;

``````````

</details>


https://github.com/llvm/llvm-project/pull/67106


More information about the lldb-commits mailing list