apelete created this revision.
apelete added a subscriber: lldb-commits.
The following warnings were reported while running clang analyzer on
LLDB code base:
API: argument with 'nonnull' attribute passed null, on file:
- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp.
Dead store: dead assignement, on file:
- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp.
Logic error: branch condition evaluates to a garbage value, on file:
- source/Core/DynamicLoader.cpp
Logic error: called C++ object pointer is null, on files:
- source/API/SBThread.cpp,
- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp,
- source/DataFormatters/VectorType.cpp (22 warnings in cpp file,
suppressed in custom assertion handler in
include/lldb/Utility/LLDBAssert.h),
- source/Core/FormatEntity.cpp.
(please note that first revision was sent only to lldb-commits mailing
list, not reviewed yet).
Signed-off-by: Apelete Seketeli <[email protected]>
http://reviews.llvm.org/D19086
Files:
include/lldb/Utility/LLDBAssert.h
source/API/SBThread.cpp
source/Core/DynamicLoader.cpp
source/Core/FormatEntity.cpp
source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
@@ -468,7 +468,6 @@
DWARFFormValue encoding_uid;
uint32_t member_byte_offset = UINT32_MAX;
DWARFExpression member_location_expression(dwarf_cu);
- bool artificial = true;
DWARFAttributes attributes;
size_t num_attributes = die.GetAttributes(attributes);
@@ -494,7 +493,7 @@
member_byte_offset = form_value.Unsigned();
break;
case DW_AT_artificial:
- artificial = form_value.Boolean();
+ // TODO: Handle when needed
break;
case DW_AT_accessibility:
// TODO: Handle when needed
@@ -506,7 +505,7 @@
}
}
- if (strcmp(name, ".dynamic_type") == 0)
+ if (name && strcmp(name, ".dynamic_type") == 0)
m_ast.SetDynamicTypeId(compiler_type, member_location_expression);
else
{
Index: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
===================================================================
--- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -306,23 +306,27 @@
if (num_bytes <= 16)
{
- const RegisterInfo *r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+ const RegisterInfo *r2_info = nullptr;
+
+ if (reg_ctx)
+ r2_info = reg_ctx->GetRegisterInfoByName("r2", 0);
+
if (num_bytes <= 8)
{
uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
- if (!reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
+ if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
error.SetErrorString ("failed to write register r2");
}
else
{
uint64_t raw_value = data.GetMaxU64(&offset, 8);
- if (reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
+ if (reg_ctx && reg_ctx->WriteRegisterFromUnsigned (r2_info, raw_value))
{
const RegisterInfo *r3_info = reg_ctx->GetRegisterInfoByName("r3", 0);
raw_value = data.GetMaxU64(&offset, num_bytes - offset);
- if (!reg_ctx->WriteRegisterFromUnsigned (r3_info, raw_value))
+ if (reg_ctx && !reg_ctx->WriteRegisterFromUnsigned (r3_info, raw_value))
error.SetErrorString ("failed to write register r3");
}
else
Index: source/Core/FormatEntity.cpp
===================================================================
--- source/Core/FormatEntity.cpp
+++ source/Core/FormatEntity.cpp
@@ -1013,7 +1013,8 @@
if (special_directions.empty())
{
- success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
+ if (item)
+ success &= item->DumpPrintableRepresentation(s,val_obj_display, custom_format);
}
else
{
Index: source/Core/DynamicLoader.cpp
===================================================================
--- source/Core/DynamicLoader.cpp
+++ source/Core/DynamicLoader.cpp
@@ -194,7 +194,7 @@
{
// Try to fetch the load address of the file from the process as we need absolute load
// address to read the file out of the memory instead of a load bias.
- bool is_loaded;
+ bool is_loaded = false;
lldb::addr_t load_addr;
Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr);
if (error.Success() && is_loaded)
Index: source/API/SBThread.cpp
===================================================================
--- source/API/SBThread.cpp
+++ source/API/SBThread.cpp
@@ -923,7 +923,7 @@
bool abort_other_plans = false;
bool stop_other_threads = false;
Thread *thread = exe_ctx.GetThreadPtr();
- if (sb_frame.GetThread().GetThreadID() != thread->GetID())
+ if (sb_frame.GetThread().GetThreadID() != thread->GetID() && log)
{
log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from another thread (0x%" PRIx64 " vrs. 0x%" PRIx64 ", returning.",
static_cast<void*>(exe_ctx.GetThreadPtr()),
Index: include/lldb/Utility/LLDBAssert.h
===================================================================
--- include/lldb/Utility/LLDBAssert.h
+++ include/lldb/Utility/LLDBAssert.h
@@ -24,7 +24,7 @@
const char* expr_text,
const char* func,
const char* file,
- unsigned int line);
+ unsigned int line) __attribute__((__noreturn__));
}
#endif // utility_LLDBAssert_h_
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits