forked from OSchip/llvm-project
[LLDB][NFC][Reliability] Fix uninitialized variables from Coverity scan. Part 3
Improve LLDB reliability by fixing the following "uninitialized variables" static code inspection warnings from scan.coverity.com/projects/llvm: 1355854, 1347549, 1316348, 1372028, 1431625, 1315634, 1315637, 1355855, 1364803, 1420505, 1420563, 1420685, 1366014, 1203966, 1204029, 1204031, 1204032, 1328411, 1325969, 1325968, 1374921, 1094809 Differential Revision: https://reviews.llvm.org/D130602
This commit is contained in:
parent
0562cf442f
commit
24301569f0
|
@ -95,10 +95,10 @@ public:
|
|||
protected:
|
||||
bool m_has[e_num];
|
||||
std::string m_name;
|
||||
lldb::addr_t m_link_map;
|
||||
lldb::addr_t m_base;
|
||||
bool m_base_is_offset;
|
||||
lldb::addr_t m_dynamic;
|
||||
lldb::addr_t m_link_map = LLDB_INVALID_ADDRESS;
|
||||
lldb::addr_t m_base = LLDB_INVALID_ADDRESS;
|
||||
bool m_base_is_offset = false;
|
||||
lldb::addr_t m_dynamic = LLDB_INVALID_ADDRESS;
|
||||
};
|
||||
|
||||
LoadedModuleInfoList() = default;
|
||||
|
|
|
@ -263,7 +263,7 @@ public:
|
|||
typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
|
||||
|
||||
protected:
|
||||
uint32_t m_my_revision;
|
||||
uint32_t m_my_revision = 0;
|
||||
Flags m_flags;
|
||||
|
||||
TypeSummaryImpl(Kind kind, const TypeSummaryImpl::Flags &flags);
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
static DebugMacroEntry
|
||||
CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp);
|
||||
|
||||
DebugMacroEntry() : m_type(INVALID) {}
|
||||
DebugMacroEntry() : m_type(INVALID), m_line(0), m_debug_line_file_idx(0) {}
|
||||
|
||||
~DebugMacroEntry() = default;
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ protected:
|
|||
|
||||
public:
|
||||
ProcessStructReader(Process *process, lldb::addr_t base_addr,
|
||||
CompilerType struct_type) {
|
||||
CompilerType struct_type)
|
||||
: m_byte_order(lldb::eByteOrderInvalid), m_addr_byte_size(0) {
|
||||
if (!process)
|
||||
return;
|
||||
if (base_addr == 0 || base_addr == LLDB_INVALID_ADDRESS)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
friend struct llvm::yaml::MappingTraits<Args::ArgEntry>;
|
||||
|
||||
std::unique_ptr<char[]> ptr;
|
||||
char quote;
|
||||
char quote = '\0';
|
||||
|
||||
char *data() { return ptr.get(); }
|
||||
|
||||
|
@ -395,7 +395,7 @@ template <> struct MappingTraits<lldb_private::Args::ArgEntry> {
|
|||
return lldb_private::Args::ArgEntry(value, quote);
|
||||
}
|
||||
StringRef value;
|
||||
uint8_t quote;
|
||||
uint8_t quote = '\0';
|
||||
};
|
||||
static void mapping(IO &io, lldb_private::Args::ArgEntry &v);
|
||||
};
|
||||
|
|
|
@ -263,8 +263,8 @@ protected:
|
|||
mutable uint8_t
|
||||
bytes[kMaxRegisterByteSize]; // This must be big enough to hold any
|
||||
// register for any supported target.
|
||||
uint16_t length;
|
||||
lldb::ByteOrder byte_order;
|
||||
uint16_t length = 0;
|
||||
lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
|
||||
} buffer;
|
||||
};
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
protected:
|
||||
ResponseValidatorCallback m_validator = nullptr;
|
||||
void *m_validator_baton;
|
||||
void *m_validator_baton = nullptr;
|
||||
};
|
||||
|
||||
#endif // LLDB_UTILITY_STRINGEXTRACTORGDBREMOTE_H
|
||||
|
|
|
@ -115,7 +115,8 @@ BreakpointOptions::BreakpointOptions(bool all_flags_set)
|
|||
: m_callback(BreakpointOptions::NullCallback),
|
||||
m_baton_is_command_baton(false), m_callback_is_synchronous(false),
|
||||
m_enabled(true), m_one_shot(false), m_ignore_count(0),
|
||||
m_condition_text_hash(0), m_auto_continue(false), m_set_flags(0) {
|
||||
m_condition_text_hash(0), m_inject_condition(false),
|
||||
m_auto_continue(false), m_set_flags(0) {
|
||||
if (all_flags_set)
|
||||
m_set_flags.Set(~((Flags::ValueType)0));
|
||||
}
|
||||
|
@ -125,11 +126,9 @@ BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
|
|||
bool auto_continue)
|
||||
: m_callback(nullptr), m_baton_is_command_baton(false),
|
||||
m_callback_is_synchronous(false), m_enabled(enabled),
|
||||
m_one_shot(one_shot), m_ignore_count(ignore),
|
||||
m_condition_text_hash(0), m_auto_continue(auto_continue)
|
||||
{
|
||||
m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot
|
||||
| eAutoContinue);
|
||||
m_one_shot(one_shot), m_ignore_count(ignore), m_condition_text_hash(0),
|
||||
m_inject_condition(false), m_auto_continue(auto_continue) {
|
||||
m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot | eAutoContinue);
|
||||
if (condition && *condition != '\0') {
|
||||
SetCondition(condition);
|
||||
}
|
||||
|
@ -141,8 +140,8 @@ BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs)
|
|||
m_baton_is_command_baton(rhs.m_baton_is_command_baton),
|
||||
m_callback_is_synchronous(rhs.m_callback_is_synchronous),
|
||||
m_enabled(rhs.m_enabled), m_one_shot(rhs.m_one_shot),
|
||||
m_ignore_count(rhs.m_ignore_count), m_auto_continue(rhs.m_auto_continue),
|
||||
m_set_flags(rhs.m_set_flags) {
|
||||
m_ignore_count(rhs.m_ignore_count), m_inject_condition(false),
|
||||
m_auto_continue(rhs.m_auto_continue), m_set_flags(rhs.m_set_flags) {
|
||||
if (rhs.m_thread_spec_up != nullptr)
|
||||
m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
|
||||
m_condition_text = rhs.m_condition_text;
|
||||
|
@ -163,6 +162,7 @@ operator=(const BreakpointOptions &rhs) {
|
|||
m_thread_spec_up = std::make_unique<ThreadSpec>(*rhs.m_thread_spec_up);
|
||||
m_condition_text = rhs.m_condition_text;
|
||||
m_condition_text_hash = rhs.m_condition_text_hash;
|
||||
m_inject_condition = rhs.m_inject_condition;
|
||||
m_auto_continue = rhs.m_auto_continue;
|
||||
m_set_flags = rhs.m_set_flags;
|
||||
return *this;
|
||||
|
|
|
@ -201,7 +201,7 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
|
|||
}
|
||||
|
||||
TargetSP target_sp;
|
||||
LoadScriptFromSymFile load_script_old_value;
|
||||
LoadScriptFromSymFile load_script_old_value = eLoadScriptFromSymFileFalse;
|
||||
if (is_load_script && exe_ctx->GetTargetSP()) {
|
||||
target_sp = exe_ctx->GetTargetSP();
|
||||
load_script_old_value =
|
||||
|
|
|
@ -588,9 +588,10 @@ public:
|
|||
}
|
||||
|
||||
Window(const char *name, const Rect &bounds)
|
||||
: Surface(Surface::Type::Window), m_name(name), m_parent(nullptr),
|
||||
m_subwindows(), m_delegate_sp(), m_curr_active_window_idx(UINT32_MAX),
|
||||
m_prev_active_window_idx(UINT32_MAX), m_delete(true),
|
||||
: Surface(Surface::Type::Window), m_name(name), m_panel(nullptr),
|
||||
m_parent(nullptr), m_subwindows(), m_delegate_sp(),
|
||||
m_curr_active_window_idx(UINT32_MAX),
|
||||
m_prev_active_window_idx(UINT32_MAX), m_delete(false),
|
||||
m_needs_update(true), m_can_activate(true), m_is_subwin(false) {
|
||||
Reset(::newwin(bounds.size.height, bounds.size.width, bounds.origin.y,
|
||||
bounds.origin.y));
|
||||
|
@ -5702,8 +5703,8 @@ protected:
|
|||
uint32_t m_selected_row_idx = 0;
|
||||
uint32_t m_first_visible_row = 0;
|
||||
uint32_t m_num_rows = 0;
|
||||
int m_min_x;
|
||||
int m_min_y;
|
||||
int m_min_x = 0;
|
||||
int m_min_y = 0;
|
||||
int m_max_x = 0;
|
||||
int m_max_y = 0;
|
||||
|
||||
|
|
|
@ -44,7 +44,8 @@ FunctionCaller::FunctionCaller(ExecutionContextScope &exe_scope,
|
|||
m_function_return_type(return_type),
|
||||
m_wrapper_function_name("__lldb_caller_function"),
|
||||
m_wrapper_struct_name("__lldb_caller_struct"), m_wrapper_args_addrs(),
|
||||
m_struct_valid(false), m_arg_values(arg_value_list), m_compiled(false),
|
||||
m_struct_valid(false), m_struct_size(0), m_return_size(0),
|
||||
m_return_offset(0), m_arg_values(arg_value_list), m_compiled(false),
|
||||
m_JITted(false) {
|
||||
m_jit_process_wp = lldb::ProcessWP(exe_scope.CalculateProcess());
|
||||
// Can't make a FunctionCaller without a process.
|
||||
|
|
|
@ -48,8 +48,8 @@ LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope,
|
|||
m_stack_frame_bottom(LLDB_INVALID_ADDRESS),
|
||||
m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false),
|
||||
m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(),
|
||||
m_materializer_up(), m_jit_module_wp(), m_can_interpret(false),
|
||||
m_materialized_address(LLDB_INVALID_ADDRESS) {}
|
||||
m_materializer_up(), m_jit_module_wp(), m_target(nullptr),
|
||||
m_can_interpret(false), m_materialized_address(LLDB_INVALID_ADDRESS) {}
|
||||
|
||||
LLVMUserExpression::~LLVMUserExpression() {
|
||||
if (m_target) {
|
||||
|
|
|
@ -255,7 +255,7 @@ void MainLoop::RunImpl::ProcessEvents() {
|
|||
}
|
||||
#endif
|
||||
|
||||
MainLoop::MainLoop() {
|
||||
MainLoop::MainLoop() : m_terminate_request(false) {
|
||||
#if HAVE_SYS_EVENT_H
|
||||
m_kqueue = kqueue();
|
||||
assert(m_kqueue >= 0);
|
||||
|
|
|
@ -37,7 +37,7 @@ OptionGroupFormat::OptionGroupFormat(
|
|||
: m_format(default_format, default_format),
|
||||
m_byte_size(default_byte_size, default_byte_size),
|
||||
m_count(default_count, default_count), m_prev_gdb_format('x'),
|
||||
m_prev_gdb_size('w') {
|
||||
m_prev_gdb_size('w'), m_has_gdb_format(false) {
|
||||
// Copy the default option definitions.
|
||||
std::copy(std::begin(g_default_option_definitions),
|
||||
std::end(g_default_option_definitions),
|
||||
|
|
|
@ -67,8 +67,10 @@ static Status ValidateSummaryString(const char *str, void *) {
|
|||
}
|
||||
|
||||
OptionGroupVariable::OptionGroupVariable(bool show_frame_options)
|
||||
: include_frame_options(show_frame_options), summary(ValidateNamedSummary),
|
||||
summary_string(ValidateSummaryString) {}
|
||||
: include_frame_options(show_frame_options), show_args(false),
|
||||
show_recognized_args(false), show_locals(false), show_globals(false),
|
||||
use_regex(false), show_scope(false), show_decl(false),
|
||||
summary(ValidateNamedSummary), summary_string(ValidateSummaryString) {}
|
||||
|
||||
Status
|
||||
OptionGroupVariable::SetOptionValue(uint32_t option_idx,
|
||||
|
|
Loading…
Reference in New Issue