Fix warnings in clang 21.1.8
This commit is contained in:
parent
ff130fa599
commit
b37131ba6c
|
|
@ -116,13 +116,11 @@ endif()
|
|||
# Target: btparser
|
||||
set(btparser_SOURCES
|
||||
cmake.toml
|
||||
"src/dbg/btparser/btparser/ast.h"
|
||||
"src/dbg/btparser/btparser/helpers.h"
|
||||
"src/dbg/btparser/btparser/keywords.h"
|
||||
"src/dbg/btparser/btparser/lexer.cpp"
|
||||
"src/dbg/btparser/btparser/lexer.h"
|
||||
"src/dbg/btparser/btparser/operators.h"
|
||||
"src/dbg/btparser/btparser/parser.cpp"
|
||||
"src/dbg/btparser/btparser/parser.h"
|
||||
"src/dbg/btparser/btparser/testfiles.h"
|
||||
)
|
||||
|
|
@ -132,6 +130,12 @@ add_library(btparser STATIC)
|
|||
target_sources(btparser PRIVATE ${btparser_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${btparser_SOURCES})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-any
|
||||
target_compile_options(btparser PUBLIC
|
||||
-Wno-self-assign-field
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(btparser PUBLIC
|
||||
"src/dbg/btparser"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ x64.OUTPUT_NAME = "x64bridge"
|
|||
type = "static"
|
||||
sources = [
|
||||
"src/dbg/btparser/btparser/lexer.cpp",
|
||||
"src/dbg/btparser/btparser/parser.cpp",
|
||||
"src/dbg/btparser/btparser/ast.h",
|
||||
"src/dbg/btparser/btparser/helpers.h",
|
||||
"src/dbg/btparser/btparser/keywords.h",
|
||||
"src/dbg/btparser/btparser/lexer.h",
|
||||
|
|
@ -61,6 +59,7 @@ sources = [
|
|||
include-directories = [
|
||||
"src/dbg/btparser",
|
||||
]
|
||||
clang-any.compile-options = ["-Wno-self-assign-field"]
|
||||
|
||||
[target.dbg]
|
||||
type = "shared"
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ static void HandleZydisOperand(const Zydis & zydis, int opindex, DISASM_ARGTYPE*
|
|||
*value += ThreadGetLocalBase(GetDebugData()->dwThreadId);
|
||||
}
|
||||
*memorySize = op.size / 8;
|
||||
if(*memorySize <= memoryContentSize && DbgMemIsValidReadPtr(*value))
|
||||
if(op.size / 8 <= memoryContentSize && DbgMemIsValidReadPtr(*value))
|
||||
{
|
||||
MemRead(*value, memoryContent, std::max(op.size / 8, (int)sizeof(duint)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ bool cbInstrMulhi(int argc, char* argv[])
|
|||
{
|
||||
#ifdef _WIN64
|
||||
unsigned __int64 res;
|
||||
_umul128(*value, value2, &res);
|
||||
(void)_umul128(*value, value2, &res);
|
||||
*value = res;
|
||||
#else //x86
|
||||
*value = (((unsigned long long)value2) * (*value)) >> 32;
|
||||
|
|
|
|||
|
|
@ -71,66 +71,52 @@ bool cbInstrVarList(int argc, char* argv[])
|
|||
filter = VAR_SYSTEM;
|
||||
}
|
||||
|
||||
size_t cbsize = 0;
|
||||
if(!varenum(0, &cbsize))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "No variables!"));
|
||||
return true;
|
||||
}
|
||||
Memory<VAR*> variables(cbsize, "cbInstrVarList:variables");
|
||||
if(!varenum(variables(), 0))
|
||||
{
|
||||
dputs(QT_TRANSLATE_NOOP("DBG", "Error listing variables!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
GuiReferenceInitialize(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Variables")));
|
||||
GuiReferenceAddColumn(2 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Value (Hex)"))); //The GUI only follows address in column 0
|
||||
GuiReferenceAddColumn(30, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Variable")));
|
||||
GuiReferenceAddColumn(3 * sizeof(duint), GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Value (Decimal)")));
|
||||
GuiReferenceAddColumn(20, GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Property")));
|
||||
int varcount = (int)cbsize / sizeof(VAR);
|
||||
int realvarcount = 0;
|
||||
GuiReferenceSetRowCount(0);
|
||||
for(int i = 0; i < varcount; i++)
|
||||
int realvarcount = 0;
|
||||
auto vars = varenum();
|
||||
for(auto & var : vars)
|
||||
{
|
||||
char value[32];
|
||||
if(variables()[i].alias.length())
|
||||
// Skip empty and alias variables
|
||||
if(var.type == VAR_HIDDEN || !var.alias.empty())
|
||||
continue;
|
||||
if(variables()[i].type != VAR_HIDDEN)
|
||||
{
|
||||
GuiReferenceSetRowCount(realvarcount + 1);
|
||||
GuiReferenceSetCellContent(realvarcount, 1, variables()[i].name.c_str());
|
||||
|
||||
GuiReferenceSetRowCount(realvarcount + 1);
|
||||
GuiReferenceSetCellContent(realvarcount, 1, var.name.c_str());
|
||||
char value[32] = "";
|
||||
#ifdef _WIN64
|
||||
sprintf_s(value, "%llX", variables()[i].value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 0, value);
|
||||
sprintf_s(value, "%llu", variables()[i].value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 2, value);
|
||||
sprintf_s(value, "%llX", var.value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 0, value);
|
||||
sprintf_s(value, "%llu", var.value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 2, value);
|
||||
#else //x86
|
||||
sprintf_s(value, "%X", variables()[i].value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 0, value);
|
||||
sprintf_s(value, "%u", variables()[i].value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 2, value);
|
||||
sprintf_s(value, "%X", var.value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 0, value);
|
||||
sprintf_s(value, "%u", var.value.u.value);
|
||||
GuiReferenceSetCellContent(realvarcount, 2, value);
|
||||
#endif //_WIN64
|
||||
const char* szType;
|
||||
switch(variables()[i].type)
|
||||
{
|
||||
case VAR_USER:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "User Variable");
|
||||
break;
|
||||
case VAR_SYSTEM:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "System Variable");
|
||||
break;
|
||||
case VAR_READONLY:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "Read Only Variable");
|
||||
break;
|
||||
default://other variables
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "System Variable");
|
||||
break;
|
||||
}
|
||||
GuiReferenceSetCellContent(realvarcount, 3, GuiTranslateText(szType));
|
||||
realvarcount++;
|
||||
const char* szType;
|
||||
switch(var.type)
|
||||
{
|
||||
case VAR_USER:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "User Variable");
|
||||
break;
|
||||
case VAR_SYSTEM:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "System Variable");
|
||||
break;
|
||||
case VAR_READONLY:
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "Read Only Variable");
|
||||
break;
|
||||
default://other variables
|
||||
szType = QT_TRANSLATE_NOOP("DBG", "System Variable");
|
||||
break;
|
||||
}
|
||||
GuiReferenceSetCellContent(realvarcount, 3, GuiTranslateText(szType));
|
||||
realvarcount++;
|
||||
}
|
||||
GuiReferenceAddCommand(GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Delete")), "vardel $1");
|
||||
GuiReferenceReloadData();
|
||||
|
|
|
|||
|
|
@ -238,10 +238,9 @@ bool SyscallInit()
|
|||
|
||||
// See: https://github.com/x64dbg/ScyllaHide/blob/6817d32581b7a420322f34e36b1a1c8c3e4b434c/Scylla/Win32kSyscalls.h
|
||||
auto result = retrieveSyscalls("ntdll.dll");
|
||||
OSVERSIONINFOW versionInfo = { sizeof(OSVERSIONINFOW) };
|
||||
GetVersionExW(&versionInfo);
|
||||
auto buildNumber = BridgeGetNtBuildNumber();
|
||||
|
||||
if(versionInfo.dwBuildNumber >= 14393)
|
||||
if(buildNumber >= 14393)
|
||||
{
|
||||
result = result && retrieveSyscalls("win32u.dll");
|
||||
}
|
||||
|
|
@ -250,7 +249,7 @@ bool SyscallInit()
|
|||
SyscallIndices.reserve(sizeof(Win32kSyscalls) / sizeof(Win32kSyscalls[0]));
|
||||
for(auto & syscall : Win32kSyscalls)
|
||||
{
|
||||
auto index = syscall.GetSyscallIndex((USHORT)versionInfo.dwBuildNumber, ArchValue(true, false));
|
||||
auto index = syscall.GetSyscallIndex((USHORT)buildNumber, ArchValue(true, false));
|
||||
if(index != -1)
|
||||
SyscallIndices.insert({ index, syscall.Name });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,23 +12,12 @@
|
|||
|
||||
bool IsVistaOrLater()
|
||||
{
|
||||
static bool vistaOrLater = []()
|
||||
{
|
||||
OSVERSIONINFOEXW osvi = { 0 };
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
return GetVersionExW((LPOSVERSIONINFOW)&osvi) && osvi.dwMajorVersion > 5;
|
||||
}();
|
||||
return vistaOrLater;
|
||||
return BridgeGetNtBuildNumber() >= 6000;
|
||||
}
|
||||
|
||||
bool Is19042OrLater()
|
||||
{
|
||||
static bool is19042OrLater = []()
|
||||
{
|
||||
auto userSharedData = SharedUserData;
|
||||
return userSharedData->NtBuildNumber >= 19042;
|
||||
}();
|
||||
return is19042OrLater;
|
||||
return BridgeGetNtBuildNumber() >= 19042;
|
||||
}
|
||||
|
||||
bool ExHandlerGetInfo(EX_HANDLER_TYPE Type, std::vector<duint> & Entries)
|
||||
|
|
|
|||
|
|
@ -534,14 +534,14 @@ void ExpressionParser::shuntingYard()
|
|||
static unsigned long long umulhi(unsigned long long x, unsigned long long y)
|
||||
{
|
||||
unsigned __int64 res;
|
||||
_umul128(x, y, &res);
|
||||
(void)_umul128(x, y, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static long long mulhi(long long x, long long y)
|
||||
{
|
||||
__int64 res;
|
||||
_mul128(x, y, &res);
|
||||
(void)_mul128(x, y, &res);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -364,35 +364,15 @@ bool vargettype(const char* Name, VAR_TYPE* Type, VAR_VALUE_TYPE* ValueType)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Enumerates all variables.
|
||||
\param [in,out] List A pointer to place the variables in. If null, \p cbsize will be filled to the number of bytes required.
|
||||
\param [in,out] Size This function retrieves the number of bytes required to store all variables. Can be null if \p entries is not null.
|
||||
\return true if it succeeds, false if it fails.
|
||||
*/
|
||||
bool varenum(VAR* List, size_t* Size)
|
||||
std::vector<VAR> varenum()
|
||||
{
|
||||
// A list or size must be requested
|
||||
if(!List && !Size)
|
||||
return false;
|
||||
|
||||
SHARED_ACQUIRE(LockVariables);
|
||||
|
||||
if(Size)
|
||||
std::vector<VAR> vars;
|
||||
vars.reserve(variables.size());
|
||||
for(const auto & itr : variables)
|
||||
{
|
||||
// Size requested, so return it
|
||||
*Size = variables.size() * sizeof(VAR);
|
||||
|
||||
if(!List)
|
||||
return true;
|
||||
vars.push_back(itr.second);
|
||||
}
|
||||
|
||||
// Fill out all list entries
|
||||
for(auto & itr : variables)
|
||||
{
|
||||
*List = VAR(itr.second);
|
||||
List++;
|
||||
}
|
||||
|
||||
return true;
|
||||
return vars;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ bool varset(const char* Name, duint Value, bool ReadOnly);
|
|||
bool varset(const char* Name, const char* Value, bool ReadOnly);
|
||||
int vardel(const char* Name, bool DelSystem);
|
||||
bool vargettype(const char* Name, VAR_TYPE* Type = nullptr, VAR_VALUE_TYPE* ValueType = nullptr);
|
||||
bool varenum(VAR* List, size_t* Size);
|
||||
std::vector<VAR> varenum();
|
||||
|
||||
#endif // _VARIABLE_H
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
if(!InitializeSignatureCheck())
|
||||
MessageBoxA(nullptr, "Failed to initialize signature check.", "Error", MB_SYSTEMMODAL | MB_ICONERROR);
|
||||
|
||||
CrashDumpInitialize();
|
||||
//CrashDumpInitialize();
|
||||
|
||||
BRIDGE_CONFIG config = {};
|
||||
const wchar_t* errormsg = BridgeInit(&config);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
int selectedCellCount() const override;
|
||||
QList<QAccessibleInterface*> selectedCells() const override;
|
||||
private:
|
||||
virtual QString getCellContent(int row, int col) const; // Get plain text of a cell
|
||||
QString getCellContent(int row, int col) const override; // Get plain text of a cell
|
||||
Disassembly* dis() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
int selectedCellCount() const override;
|
||||
QList<QAccessibleInterface*> selectedCells() const override;
|
||||
private:
|
||||
virtual QString getCellContent(int row, int col) const; // Get plain text of a cell
|
||||
QString getCellContent(int row, int col) const override; // Get plain text of a cell
|
||||
HexDump* dump() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
int selectedCellCount() const override;
|
||||
QList<QAccessibleInterface*> selectedCells() const override;
|
||||
private:
|
||||
virtual QString getCellContent(int row, int col) const; // Get plain text of a cell
|
||||
QString getCellContent(int row, int col) const override; // Get plain text of a cell
|
||||
AbstractStdTable* table() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public:
|
|||
int selectedCellCount() const override;
|
||||
QList<QAccessibleInterface*> selectedCells() const override;
|
||||
private:
|
||||
virtual QString getCellContent(int row, int col) const; // Get plain text of a cell
|
||||
QString getCellContent(int row, int col) const override; // Get plain text of a cell
|
||||
TraceBrowser* dis() const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -404,8 +404,8 @@ void LogView::redirectLogToFileSlot(QString filename)
|
|||
logRedirection = nullptr;
|
||||
GuiAddLogMessage(tr("Log redirection is stopped.\n").toUtf8().constData());
|
||||
}
|
||||
logRedirection = _wfopen(filename.toStdWString().c_str(), L"ab");
|
||||
if(logRedirection == nullptr)
|
||||
errno_t err = _wfopen_s(&logRedirection, filename.toStdWString().c_str(), L"ab");
|
||||
if(err != 0 || logRedirection == nullptr)
|
||||
GuiAddLogMessage(tr("_wfopen() failed. Log will not be redirected to %1.\n").arg(QString::fromWCharArray(BridgeUserDirectory())).toUtf8().constData());
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -200,6 +200,6 @@ private:
|
|||
void disasmByAddress(duint address, bool history = true);
|
||||
TraceWidget* mParent;
|
||||
friend class AccessibleTraceBrowser;
|
||||
int accessibilitySelectedRow() const;
|
||||
int accessibilitySelectedRow() const override;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -244,8 +244,8 @@ bool ExportCSV(dsint rows, dsint columns, std::vector<QString> headers, std::fun
|
|||
bool utf16;
|
||||
bool isTSV;
|
||||
isTSV = browse.path.endsWith(".tsv", Qt::CaseInsensitive);
|
||||
csv = _wfopen(browse.path.toStdWString().c_str(), L"wb");
|
||||
if(csv == NULL)
|
||||
auto err = _wfopen_s(&csv, browse.path.toStdWString().c_str(), L"wb");
|
||||
if(err != 0 || csv == nullptr)
|
||||
{
|
||||
goto FAILED_NOFCLOSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ static void handleHighDpiScaling()
|
|||
setDpiUnaware();
|
||||
|
||||
// These options don't seem to do anything, but the Qt documentation recommends it
|
||||
putenv("QT_AUTO_SCREEN_SCALE_FACTOR=1");
|
||||
_putenv("QT_AUTO_SCREEN_SCALE_FACTOR=1");
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue