Improve LLDB reliability by fixing the following "uninitialized variables" static code inspection warnings from
scan.coverity.com:
1476275, 1274012, 1455035, 1364789, 1454282
1467483, 1406152, 1406255, 1454837, 1454416
1467446, 1462022, 1461909, 1420566, 1327228
1367767, 1431254, 1467299, 1312678, 1431780
1454731, 1490403
Differential Revision: https://reviews.llvm.org/D130528
lldb_private::minidump::MinidumpContext_x86_64
GetThreadContext_64(RegisterContext *reg_ctx) {
- lldb_private::minidump::MinidumpContext_x86_64 thread_context;
+ lldb_private::minidump::MinidumpContext_x86_64 thread_context = {};
thread_context.p1_home = {};
thread_context.context_flags = static_cast<uint32_t>(
lldb_private::minidump::MinidumpContext_x86_64_Flags::x86_64_Flag |
helper_data.AppendData(
&thread_context, sizeof(lldb_private::minidump::MinidumpContext_x86_64));
- Exception exp_record;
+ Exception exp_record = {};
exp_record.ExceptionCode =
static_cast<llvm::support::ulittle32_t>(stop_info_sp->GetValue());
exp_record.ExceptionFlags = static_cast<llvm::support::ulittle32_t>(0);
}
// Wait for the child process to trap on its call to execve.
- int wstatus;
+ int wstatus = 0;
::pid_t wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, pid, &wstatus, 0);
assert(wpid == pid);
(void)wpid;
RegisterContextDarwin_arm64::RegisterContextDarwin_arm64(
Thread &thread, uint32_t concrete_frame_idx)
- : RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc() {
+ : RegisterContext(thread, concrete_frame_idx), gpr(), fpu(), exc(), dbg() {
uint32_t i;
for (i = 0; i < kNumErrors; i++) {
gpr_errs[i] = -1;
ThreadMemory::ThreadMemory(Process &process, tid_t tid,
const ValueObjectSP &thread_info_valobj_sp)
: Thread(process, tid), m_backing_thread_sp(),
- m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue() {}
+ m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue(),
+ m_register_data_addr(LLDB_INVALID_ADDRESS) {}
ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
llvm::StringRef name, llvm::StringRef queue,
// To be extracted from struct netbsd_elfcore_procinfo
// Used to sanity check of the LWPs of the process
uint32_t nlwps = 0;
- uint32_t signo; // killing signal
- uint32_t siglwp; // LWP target of killing signal
- uint32_t pr_pid;
+ uint32_t signo = 0; // killing signal
+ uint32_t siglwp = 0; // LWP target of killing signal
+ uint32_t pr_pid = 0;
for (const auto ¬e : notes) {
llvm::StringRef name = note.info.n_name;
}
llvm::Error ProcessElfCore::parseOpenBSDNotes(llvm::ArrayRef<CoreNote> notes) {
- ThreadData thread_data;
+ ThreadData thread_data = {};
for (const auto ¬e : notes) {
// OpenBSD per-thread information is stored in notes named "OpenBSD@nnn" so
// match on the initial part of the string.
const FileSpec &core_file,
DataBufferSP core_data)
: PostMortemProcess(target_sp, listener_sp), m_core_file(core_file),
- m_core_data(std::move(core_data)), m_is_wow64(false) {}
+ m_core_data(std::move(core_data)), m_active_exception(nullptr),
+ m_is_wow64(false) {}
ProcessMinidump::~ProcessMinidump() {
Clear();
}
VariableInfo lldb_private::npdb::GetVariableNameInfo(CVSymbol sym) {
- VariableInfo result;
+ VariableInfo result = {};
if (sym.kind() == S_REGREL32) {
RegRelativeSym reg(SymbolRecordKind::RegRelativeSym);
SystemRuntimeMacOSX::PendingItemsForQueue
SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) {
- PendingItemsForQueue pending_item_refs;
+ PendingItemsForQueue pending_item_refs = {};
AppleGetPendingItemsHandler::GetPendingItemsReturnInfo pending_items_pointer;
ThreadSP cur_thread_sp(
m_process->GetThreadList().GetExpressionExecutionThread());
UnwindPlan::RowSP prologue_completed_row; // copy of prologue row of CFI
int prologue_completed_sp_bytes_offset_from_cfa; // The sp value before the
// epilogue started executed
- bool prologue_completed_is_aligned;
+ bool prologue_completed_is_aligned = false;
std::vector<bool> prologue_completed_saved_registers;
while (current_func_text_offset < size) {
}
Type::Type()
- : std::enable_shared_from_this<Type>(), UserID(0),
- m_name("<INVALID TYPE>") {
+ : std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"),
+ m_payload(0) {
m_byte_size = 0;
m_byte_size_has_value = false;
}
m_memory_cache(*this), m_allocated_memory_cache(*this),
m_should_detach(false), m_next_event_action_up(), m_public_run_lock(),
m_private_run_lock(), m_finalizing(false),
- m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false),
- m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false),
- m_can_interpret_function_calls(false), m_run_thread_plan_lock(),
- m_can_jit(eCanJITDontKnow) {
+ m_clear_thread_plans_on_stop(false),
+ m_currently_handling_do_on_removals(false), m_resume_requested(false),
+ m_force_next_event_delivery(false), m_last_broadcast_state(eStateInvalid),
+ m_destroy_in_process(false), m_can_interpret_function_calls(false),
+ m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow) {
CheckInWithManager();
Log *log = GetLog(LLDBLog::Object);
private:
lldb::ThreadPlanSP m_thread_plan_sp;
bool m_already_reset = false;
- bool m_private;
- bool m_is_controlling;
- bool m_okay_to_discard;
+ bool m_private = false;
+ bool m_is_controlling = false;
+ bool m_okay_to_discard = false;
};
} // anonymous namespace
// unwindplan_regloc has valid contents about where to retrieve the register
if (unwindplan_regloc.IsUnspecified()) {
- lldb_private::UnwindLLDB::RegisterLocation new_regloc;
+ lldb_private::UnwindLLDB::RegisterLocation new_regloc = {};
new_regloc.type = UnwindLLDB::RegisterLocation::eRegisterNotSaved;
m_registers[regnum.GetAsKind(eRegisterKindLLDB)] = new_regloc;
UnwindLogMsg("save location for %s (%d) is unspecified, continue searching",
addr_t old_caller_pc_value = LLDB_INVALID_ADDRESS;
addr_t new_caller_pc_value = LLDB_INVALID_ADDRESS;
- UnwindLLDB::RegisterLocation regloc;
+ UnwindLLDB::RegisterLocation regloc = {};
if (SavedLocationForRegister(pc_regnum.GetAsKind(eRegisterKindLLDB),
regloc) ==
UnwindLLDB::RegisterSearchResult::eRegisterFound) {
m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
m_debug_execution(options.GetDebug()),
m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function),
- m_function_sp(0), m_takedown_done(false),
+ m_start_addr(), m_function_sp(0), m_subplan_sp(),
+ m_cxx_language_runtime(nullptr), m_objc_language_runtime(nullptr),
+ m_stored_thread_state(), m_real_stop_info_sp(), m_constructor_errors(),
+ m_return_valobj_sp(), m_takedown_done(false),
m_should_clear_objc_exception_bp(false),
m_should_clear_cxx_exception_bp(false),
m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(return_type) {
m_ignore_breakpoints(options.DoesIgnoreBreakpoints()),
m_debug_execution(options.GetDebug()),
m_trap_exceptions(options.GetTrapExceptions()), m_function_addr(function),
- m_function_sp(0), m_takedown_done(false),
- m_should_clear_objc_exception_bp(false),
+ m_start_addr(), m_function_sp(0), m_subplan_sp(),
+ m_cxx_language_runtime(nullptr), m_objc_language_runtime(nullptr),
+ m_stored_thread_state(), m_real_stop_info_sp(), m_constructor_errors(),
+ m_return_valobj_sp(), m_takedown_done(false), m_function_sp(0),
+ m_takedown_done(false), m_should_clear_objc_exception_bp(false),
m_should_clear_cxx_exception_bp(false),
m_stop_address(LLDB_INVALID_ADDRESS), m_return_type(CompilerType()) {}
ThreadPlanTracer::ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
: m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
- m_enabled(false), m_stream_sp(stream_sp) {}
+ m_enabled(false), m_stream_sp(stream_sp), m_thread(nullptr) {}
ThreadPlanTracer::ThreadPlanTracer(Thread &thread)
: m_process(*thread.GetProcess().get()), m_tid(thread.GetID()),
- m_enabled(false), m_stream_sp() {}
+ m_enabled(false), m_stream_sp(), m_thread(nullptr) {}
Stream *ThreadPlanTracer::GetLogStream() {
if (m_stream_sp)
}
TraceDumper::TraceItem TraceDumper::CreatRawTraceItem() {
- TraceItem item;
+ TraceItem item = {};
item.id = m_cursor_up->GetId();
if (m_options.show_tsc)