Merge pull request #2492 from lioncash/debugger

yuzu/debugger: Specify string conversions explicitly
This commit is contained in:
Hexagon12 2019-05-19 14:49:54 +01:00 committed by GitHub
commit 209a0dfa35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 17 deletions

View File

@ -135,7 +135,7 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent) std::shared_ptr<Tegra::DebugContext> debug_context, QWidget* parent)
: QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver( : QDockWidget(tr("Maxwell Breakpoints"), parent), Tegra::DebugContext::BreakPointObserver(
debug_context) { debug_context) {
setObjectName("TegraBreakPointsWidget"); setObjectName(QStringLiteral("TegraBreakPointsWidget"));
status_text = new QLabel(tr("Emulation running")); status_text = new QLabel(tr("Emulation running"));
resume_button = new QPushButton(tr("Resume")); resume_button = new QPushButton(tr("Resume"));

View File

@ -47,7 +47,7 @@ private:
#endif #endif
MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) { MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Dialog) {
setObjectName("MicroProfile"); setObjectName(QStringLiteral("MicroProfile"));
setWindowTitle(tr("MicroProfile")); setWindowTitle(tr("MicroProfile"));
resize(1000, 600); resize(1000, 600);
// Remove the "?" button from the titlebar and enable the maximize button // Remove the "?" button from the titlebar and enable the maximize button
@ -191,7 +191,7 @@ void MicroProfileDrawText(int x, int y, u32 hex_color, const char* text, u32 tex
for (u32 i = 0; i < text_length; ++i) { for (u32 i = 0; i < text_length; ++i) {
// Position the text baseline 1 pixel above the bottom of the text cell, this gives nice // Position the text baseline 1 pixel above the bottom of the text cell, this gives nice
// vertical alignment of text for a wide range of tested fonts. // vertical alignment of text for a wide range of tested fonts.
mp_painter->drawText(x, y + MICROPROFILE_TEXT_HEIGHT - 2, QChar(text[i])); mp_painter->drawText(x, y + MICROPROFILE_TEXT_HEIGHT - 2, QString{QLatin1Char{text[i]}});
x += MICROPROFILE_TEXT_WIDTH + 1; x += MICROPROFILE_TEXT_WIDTH + 1;
} }
} }

View File

@ -91,19 +91,19 @@ WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::HandleTa
WaitTreeMutexInfo::~WaitTreeMutexInfo() = default; WaitTreeMutexInfo::~WaitTreeMutexInfo() = default;
QString WaitTreeMutexInfo::GetText() const { QString WaitTreeMutexInfo::GetText() const {
return tr("waiting for mutex 0x%1").arg(mutex_address, 16, 16, QLatin1Char('0')); return tr("waiting for mutex 0x%1").arg(mutex_address, 16, 16, QLatin1Char{'0'});
} }
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() const { std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() const {
const bool has_waiters = (mutex_value & Kernel::Mutex::MutexHasWaitersFlag) != 0;
std::vector<std::unique_ptr<WaitTreeItem>> list; std::vector<std::unique_ptr<WaitTreeItem>> list;
bool has_waiters = (mutex_value & Kernel::Mutex::MutexHasWaitersFlag) != 0;
list.push_back(std::make_unique<WaitTreeText>(tr("has waiters: %1").arg(has_waiters))); list.push_back(std::make_unique<WaitTreeText>(tr("has waiters: %1").arg(has_waiters)));
list.push_back(std::make_unique<WaitTreeText>( list.push_back(std::make_unique<WaitTreeText>(
tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char('0')))); tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'})));
if (owner != nullptr) if (owner != nullptr) {
list.push_back(std::make_unique<WaitTreeThread>(*owner)); list.push_back(std::make_unique<WaitTreeThread>(*owner));
}
return list; return list;
} }
@ -121,11 +121,14 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
u64 base_pointer = thread.GetContext().cpu_registers[BaseRegister]; u64 base_pointer = thread.GetContext().cpu_registers[BaseRegister];
while (base_pointer != 0) { while (base_pointer != 0) {
u64 lr = Memory::Read64(base_pointer + sizeof(u64)); const u64 lr = Memory::Read64(base_pointer + sizeof(u64));
if (lr == 0) if (lr == 0) {
break; break;
list.push_back( }
std::make_unique<WaitTreeText>(tr("0x%1").arg(lr - sizeof(u32), 16, 16, QChar('0'))));
list.push_back(std::make_unique<WaitTreeText>(
tr("0x%1").arg(lr - sizeof(u32), 16, 16, QLatin1Char{'0'})));
base_pointer = Memory::Read64(base_pointer); base_pointer = Memory::Read64(base_pointer);
} }
@ -249,9 +252,9 @@ QString WaitTreeThread::GetText() const {
const auto& context = thread.GetContext(); const auto& context = thread.GetContext();
const QString pc_info = tr(" PC = 0x%1 LR = 0x%2") const QString pc_info = tr(" PC = 0x%1 LR = 0x%2")
.arg(context.pc, 8, 16, QLatin1Char('0')) .arg(context.pc, 8, 16, QLatin1Char{'0'})
.arg(context.cpu_registers[30], 8, 16, QLatin1Char('0')); .arg(context.cpu_registers[30], 8, 16, QLatin1Char{'0'});
return WaitTreeWaitObject::GetText() + pc_info + " (" + status + ") "; return QStringLiteral("%1%2 (%3) ").arg(WaitTreeWaitObject::GetText(), pc_info, status);
} }
QColor WaitTreeThread::GetColor() const { QColor WaitTreeThread::GetColor() const {
@ -424,7 +427,7 @@ void WaitTreeModel::InitItems() {
} }
WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("Wait Tree"), parent) { WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("Wait Tree"), parent) {
setObjectName("WaitTreeWidget"); setObjectName(QStringLiteral("WaitTreeWidget"));
view = new QTreeView(this); view = new QTreeView(this);
view->setHeaderHidden(true); view->setHeaderHidden(true);
setWidget(view); setWidget(view);