-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[lldb] progressive progress reporting for darwin kernel/firmware #98845
Changes from 6 commits
cead9ae
b78da7e
26e87f3
2e89de9
e3c60ee
ebd9b8b
dbbda57
e5b4275
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
#include "lldb/Core/Module.h" | ||
#include "lldb/Core/ModuleSpec.h" | ||
#include "lldb/Core/PluginManager.h" | ||
#include "lldb/Core/Progress.h" | ||
#include "lldb/Expression/DiagnosticManager.h" | ||
#include "lldb/Expression/DynamicCheckerFunctions.h" | ||
#include "lldb/Expression/UserExpression.h" | ||
|
@@ -2545,6 +2546,13 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec, | |
ModuleSP module_sp(new Module(file_spec, ArchSpec())); | ||
if (module_sp) { | ||
Status error; | ||
std::unique_ptr<Progress> progress_up; | ||
// Reading an ObjectFile from a local corefile is very fast, | ||
// don't print a progress report. | ||
if (!GetCoreFile()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be better to use the bool accessor function:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name is a little misleading, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh whoops, my bad on that one, thanks. I'll change to use this instead, it's clearer. |
||
progress_up = std::make_unique<Progress>( | ||
"Reading binary from memory", file_spec.GetFilename().GetString()); | ||
|
||
ObjectFile *objfile = module_sp->GetMemoryObjectFile( | ||
shared_from_this(), header_addr, error, size_to_read); | ||
if (objfile) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to check if the UUID is valid in the if statement and then set the architecture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I have a UUID, it's authoritative, whereas the ArchSpec might be heuristically determined. I don't like setting both in a ModuleSpec if the UUID is valid, it it noramlly fine but it's a little footgun waiting for some unusual combination where the heuristically determined ArchSpec is not quite the same ("compatible") with the arch of the UUID specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I shouldn't be making changes like this at the same time as adding progress status logging, but it irked me when I saw it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to be clear, it's almost always the "environment" or "os" part of the triple, which is nearly an entire fiction with firmware style debugging, that is the problem. One binary will say "hey I'm iOS" and another binary that needs to be loaded also is like "I'm something else" and lldb will reject the module load even though the UUIDs match.