Skip to content

[lldb][dump-debug-info] Fix image dump separate-debug-info in Release. #68940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

zhyty
Copy link
Contributor

@zhyty zhyty commented Oct 13, 2023

Follow up to #66035.

@kazutakahirata noticed (comment) 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.

@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.
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2023

@llvm/pr-subscribers-lldb

Author: Tom Yang (zhyty)

Changes

Follow up to #66035.

@kazutakahirata noticed (comment) 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.


Full diff: https://github.com/llvm/llvm-project/pull/68940.diff

1 Files Affected:

  • (modified) lldb/source/Commands/CommandObjectTarget.cpp (+15-7)
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();

@zhyty
Copy link
Contributor Author

zhyty commented Oct 13, 2023

#68979 was committed before this, basically does the same thing.

@zhyty zhyty closed this Oct 13, 2023
@zhyty zhyty deleted the fix-dump-dwos-assert branch November 1, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants