[Lldb-commits] [lldb] [lldb][dump-debug-info] Fix `image dump separate-debug-info` in Release. (PR #68940)
Tom Yang via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 12 17:06:11 PDT 2023
https://github.com/zhyty created https://github.com/llvm/llvm-project/pull/68940
Follow up to #66035.
@kazutakahirata noticed ([comment](https://github.com/llvm/llvm-project/commit/64d78d8b3cd09dff32c97fbefa56bcfc8b676406#r129848406)) that I was reading structured data in assert statements which were being removed when asserts are disabled. I've removed the assert statements, which only existed as a sanity check anyway.
>From adf6ab21c967e48a1a6aa8699ae54d458ced3886 Mon Sep 17 00:00:00 2001
From: Tom Yang <toyang at fb.com>
Date: Thu, 12 Oct 2023 16:52:26 -0700
Subject: [PATCH] [lldb][dump-debug-info] Fix `image dump separate-debug-info`
in Release.
@kazutakahirata noticed that I was reading structured data in assert
statements which were being removed when asserts are disabled. I've
removed the assert statements, which only existed as a sanity check
anyway.
---
lldb/source/Commands/CommandObjectTarget.cpp | 22 +++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 0c378b069086d03..e1f54b810486611 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2679,15 +2679,23 @@ class CommandObjectTargetModulesDumpSeparateDebugInfoFiles
return false;
}
+ // We expect to see "type", "symfile", and
+ // "separate-debug-info-files" as fields in the dictionary, even
+ // if they're empty.
llvm::StringRef type;
+ separate_debug_info_list->GetValueForKeyAsString("type", type);
llvm::StringRef symfile;
- StructuredData::Array *files;
- assert(separate_debug_info_list->GetValueForKeyAsString("type",
- type));
- assert(separate_debug_info_list->GetValueForKeyAsString("symfile",
- symfile));
- assert(separate_debug_info_list->GetValueForKeyAsArray(
- "separate-debug-info-files", files));
+ separate_debug_info_list->GetValueForKeyAsString("symfile",
+ symfile);
+ StructuredData::Array *files = nullptr;
+ separate_debug_info_list->GetValueForKeyAsArray(
+ "separate-debug-info-files", files);
+ if (files == nullptr) {
+ result.AppendWarningWithFormat(
+ "Expected \"separate-debug-info-files\" field in separate "
+ "debug info dictionary");
+ return false;
+ }
strm << "Symbol file: " << symfile;
strm.EOL();
More information about the lldb-commits
mailing list