diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index 1e91f2ccd1982..b4f1b76c39dbe 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -949,7 +949,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, Status PlatformPOSIX::UnloadImage(lldb_private::Process *process, uint32_t image_token) { const addr_t image_addr = process->GetImagePtrFromToken(image_token); - if (image_addr == LLDB_INVALID_ADDRESS) + if (image_addr == LLDB_INVALID_IMAGE_TOKEN) return Status("Invalid image token"); StreamString expr; diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index cbac14e2ccf7a..88d543289a847 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -415,7 +415,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process, Status PlatformWindows::UnloadImage(Process *process, uint32_t image_token) { const addr_t address = process->GetImagePtrFromToken(image_token); - if (address == LLDB_INVALID_ADDRESS) + if (address == LLDB_INVALID_IMAGE_TOKEN) return Status("invalid image token"); StreamString expression; diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 2b07745881388..f82ab05362fbe 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -5911,12 +5911,12 @@ size_t Process::AddImageToken(lldb::addr_t image_ptr) { lldb::addr_t Process::GetImagePtrFromToken(size_t token) const { if (token < m_image_tokens.size()) return m_image_tokens[token]; - return LLDB_INVALID_ADDRESS; + return LLDB_INVALID_IMAGE_TOKEN; } void Process::ResetImageToken(size_t token) { if (token < m_image_tokens.size()) - m_image_tokens[token] = LLDB_INVALID_ADDRESS; + m_image_tokens[token] = LLDB_INVALID_IMAGE_TOKEN; } Address diff --git a/lldb/test/API/functionalities/load_unload/TestLoadUnload.py b/lldb/test/API/functionalities/load_unload/TestLoadUnload.py index 7e8acfa3021ac..2208e520f1d56 100644 --- a/lldb/test/API/functionalities/load_unload/TestLoadUnload.py +++ b/lldb/test/API/functionalities/load_unload/TestLoadUnload.py @@ -307,6 +307,15 @@ def run_lldb_process_load_and_unload_commands(self): patterns=["Unloading .* with index %s.*ok" % index], ) + # Confirm that we unloaded properly. + self.expect( + "image lookup -n a_function", + "a_function should not exist after unload", + error=True, + matching=False, + patterns=["1 match found"], + ) + self.runCmd("process continue") @expectedFailureAll(oslist=["windows"]) # breakpoint not hit