0
0
mirror of https://notabug.org/litucks/torzu.git synced 2025-04-24 09:05:13 +00:00

Update some Android dependencies and fix build by making boost-process optional (#120)

Based on #119

Co-authored-by: Ramiro <ramiro.depaoli@gmail.com>
Co-authored-by: spectranator <spectranator@y2nlvhmmk5jnsvechppxnbyzmmv3vbl7dvzn6ltwcdbpgxixp3clkgqd.onion>
Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/120
This commit is contained in:
spectranator 2025-04-16 19:47:40 +00:00
parent 8561b75518
commit 634acab40b
20 changed files with 203 additions and 100 deletions

View File

@ -63,6 +63,8 @@ option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
option(YUZU_NO_CPU_DEBUGGER "Do not build debugging code" OFF)
option(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")
option(YUZU_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
@ -170,7 +172,7 @@ endif()
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL)
set(vvl_version "sdk-1.3.261.1")
set(vvl_version "1.4.304.1")
set(vvl_zip_file "${CMAKE_BINARY_DIR}/externals/vvl-android.zip")
set(vvl_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/src/android/app/src/main/jniLibs/arm64-v8a/")

View File

@ -44,9 +44,9 @@ https://developer.android.com/studio/intro
### Dependencies
```
sudo apt-get update
sudo apt-get install -y sdkmanager openjdk-17-jdk build-essential curl git pkg-config glslang-tools zip
sudo sdkmanager "ndk;26.3.11579264" "platforms;android-34" "build-tools;34.0.0" "cmake;3.22.1" "platform-tools;34.0.5"
sudo update-alternatives --config java # Select Java 17 here if possible
sudo apt-get install -y sdkmanager openjdk-21-jdk build-essential curl git pkg-config glslang-tools zip
sudo sdkmanager "ndk;26.3.11579264" "platforms;android-35" "build-tools;35.0.0" "cmake;3.22.1" "platform-tools;35.0.5"
sudo update-alternatives --config java # Select Java 21 here if possible
```
### Cloning Yuzu with Git

View File

@ -27,7 +27,7 @@ val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toIn
android {
namespace = "org.yuzu.yuzu_emu"
compileSdkVersion = "android-34"
compileSdkVersion = "android-35"
ndkVersion = "26.3.11579264"
buildFeatures {
@ -35,12 +35,12 @@ android {
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "21"
}
packaging {
@ -118,7 +118,6 @@ android {
isDefault = true
resValue("string", "app_name_suffixed", "yuzu Debug Release")
signingConfig = signingConfigs.getByName("default")
isMinifyEnabled = true
isDebuggable = true
proguardFiles(
getDefaultProguardFile("proguard-android.txt"),
@ -165,9 +164,10 @@ android {
"-DENABLE_WEB_SERVICE=0", // Don't use telemetry
"-DBUNDLE_SPEEX=ON",
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
"-DYUZU_NO_CPU_DEBUGGER=ON",
"-DYUZU_ENABLE_LTO=ON",
"-DYUZU_USE_BUNDLED_VCPKG=ON",
"-DYUZU_USE_BUNDLED_FFMPEG=ON",
"-DYUZU_ENABLE_LTO=ON",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
)

View File

@ -297,7 +297,9 @@ void EmulationSession::ShutdownEmulation() {
// Shutdown the main emulated process
if (m_load_result == Core::SystemResultStatus::Success) {
#ifndef YUZU_NO_CPU_DEBUGGER
m_system.DetachDebugger();
#endif
m_system.ShutdownMainProcess();
m_detached_tasks.WaitForAllTasks();
m_load_result = Core::SystemResultStatus::ErrorNotInitialized;
@ -344,9 +346,11 @@ void EmulationSession::RunEmulation() {
void(m_system.Run());
#ifndef YUZU_NO_CPU_DEBUGGER
if (m_system.DebuggerEnabled()) {
m_system.InitializeDebugger();
}
#endif
while (true) {
{

View File

@ -17,4 +17,4 @@ kotlin.parallel.tasks.in.project=true
android.defaults.buildfeatures.buildconfig=true
# Android Gradle plugin 8.0.2
android.suppressUnsupportedCompileSdk=34
android.suppressUnsupportedCompileSdk=35

View File

@ -30,13 +30,6 @@ add_library(core STATIC
crypto/partition_data_manager.h
crypto/xts_encryption_layer.cpp
crypto/xts_encryption_layer.h
debugger/debugger.cpp
debugger/debugger.h
debugger/debugger_interface.h
debugger/gdbstub.cpp
debugger/gdbstub.h
debugger/gdbstub_arch.cpp
debugger/gdbstub_arch.h
device_memory.cpp
device_memory.h
device_memory_manager.h
@ -1142,6 +1135,20 @@ add_library(core STATIC
tools/renderdoc.h
)
if (YUZU_NO_CPU_DEBUGGER)
target_compile_definitions(core PUBLIC YUZU_NO_CPU_DEBUGGER)
else()
target_sources(core PRIVATE
debugger/debugger.cpp
debugger/debugger.h
debugger/debugger_interface.h
debugger/gdbstub.cpp
debugger/gdbstub.h
debugger/gdbstub_arch.cpp
debugger/gdbstub_arch.h
)
endif()
if (MSVC)
target_compile_options(core PRIVATE
/we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch

View File

@ -16,10 +16,15 @@ using namespace Common::Literals;
class DynarmicCallbacks32 : public Dynarmic::A32::UserCallbacks {
public:
explicit DynarmicCallbacks32(ArmDynarmic32& parent, Kernel::KProcess* process)
: m_parent{parent}, m_memory(process->GetMemory()),
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
m_check_memory_access{m_debugger_enabled ||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
: m_parent{parent}
, m_memory(process->GetMemory())
, m_process(process)
#ifndef YUZU_NO_CPU_DEBUGGER
, m_debugger_enabled{parent.m_system.DebuggerEnabled()}
#endif
, m_check_memory_access{m_debugger_enabled
|| !Settings::values.cpuopt_ignore_memory_aborts.GetValue()}
{}
u8 MemoryRead8(u32 vaddr) override {
CheckMemoryAccess(vaddr, 1, Kernel::DebugWatchpointType::Read);
@ -213,10 +218,12 @@ std::shared_ptr<Dynarmic::A32::Jit> ArmDynarmic32::MakeJit(Common::PageTable* pa
config.code_cache_size = 512_MiB;
#endif
#ifndef YUZU_NO_CPU_DEBUGGER
// Allow memory fault handling to work
if (m_system.DebuggerEnabled()) {
config.check_halt_on_memory_access = true;
}
#endif
// null_jit
if (!page_table) {

View File

@ -16,10 +16,18 @@ using namespace Common::Literals;
class DynarmicCallbacks64 : public Dynarmic::A64::UserCallbacks {
public:
explicit DynarmicCallbacks64(ArmDynarmic64& parent, Kernel::KProcess* process)
: m_parent{parent}, m_memory(process->GetMemory()),
m_process(process), m_debugger_enabled{parent.m_system.DebuggerEnabled()},
m_check_memory_access{m_debugger_enabled ||
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()} {}
: m_parent{parent}
, m_memory(process->GetMemory())
, m_process(process)
#ifndef YUZU_NO_CPU_DEBUGGER
, m_debugger_enabled{parent.m_system.DebuggerEnabled()}
#endif
, m_check_memory_access{
#ifndef YUZU_NO_CPU_DEBUGGER
m_debugger_enabled ||
#endif
!Settings::values.cpuopt_ignore_memory_aborts.GetValue()}
{}
u8 MemoryRead8(u64 vaddr) override {
CheckMemoryAccess(vaddr, 1, Kernel::DebugWatchpointType::Read);
@ -139,10 +147,12 @@ public:
ReturnException(pc, PrefetchAbort);
return;
default:
#ifndef YUZU_NO_CPU_DEBUGGER
if (m_debugger_enabled) {
ReturnException(pc, InstructionBreakpoint);
return;
}
#endif
m_parent.LogBacktrace(m_process);
LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",
@ -192,6 +202,7 @@ public:
return false;
}
#ifndef YUZU_NO_CPU_DEBUGGER
if (!m_debugger_enabled) {
return true;
}
@ -202,6 +213,7 @@ public:
m_parent.m_jit->HaltExecution(DataAbort);
return false;
}
#endif
return true;
}
@ -217,7 +229,9 @@ public:
u64 m_tpidrro_el0{};
u64 m_tpidr_el0{};
Kernel::KProcess* m_process{};
#ifndef YUZU_NO_CPU_DEBUGGER
const bool m_debugger_enabled{};
#endif
const bool m_check_memory_access{};
static constexpr u64 MinimumRunCycles = 10000U;
};
@ -272,10 +286,12 @@ std::shared_ptr<Dynarmic::A64::Jit> ArmDynarmic64::MakeJit(Common::PageTable* pa
config.code_cache_size = 512_MiB;
#endif
#ifndef YUZU_NO_CPU_DEBUGGER
// Allow memory fault handling to work
if (m_system.DebuggerEnabled()) {
config.check_halt_on_memory_access = true;
}
#endif
// null_jit
if (!page_table) {

View File

@ -256,9 +256,11 @@ struct System::Impl {
return nvdec_active;
}
#ifndef YUZU_NO_CPU_DEBUGGER
void InitializeDebugger(System& system, u16 port) {
debugger = std::make_unique<Debugger>(system, port);
}
#endif
void InitializeKernel(System& system) {
LOG_DEBUG(Core, "initialized OK");
@ -421,7 +423,9 @@ struct System::Impl {
host1x_core.reset();
perf_stats.reset();
cpu_manager.Shutdown();
#ifndef YUZU_NO_CPU_DEBUGGER
debugger.reset();
#endif
kernel.Shutdown();
stop_event = {};
Network::RestartSocketOperations();
@ -516,8 +520,10 @@ struct System::Impl {
/// Network instance
Network::NetworkInstance network_instance;
#ifndef YUZU_NO_CPU_DEBUGGER
/// Debugger
std::unique_ptr<Core::Debugger> debugger;
#endif
SystemResultStatus status = SystemResultStatus::Success;
std::string status_details = "";
@ -582,11 +588,13 @@ void System::SetShuttingDown(bool shutting_down) {
impl->SetShuttingDown(shutting_down);
}
#ifndef YUZU_NO_CPU_DEBUGGER
void System::DetachDebugger() {
if (impl->debugger) {
impl->debugger->NotifyShutdown();
}
}
#endif
std::unique_lock<std::mutex> System::StallApplication() {
return impl->StallApplication();
@ -604,9 +612,11 @@ bool System::GetNVDECActive() {
return impl->GetNVDECActive();
}
#ifndef YUZU_NO_CPU_DEBUGGER
void System::InitializeDebugger() {
impl->InitializeDebugger(*this, Settings::values.gdbstub_port.GetValue());
}
#endif
SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
Service::AM::FrontendAppletParameters& params) {
@ -927,6 +937,7 @@ bool System::IsMulticore() const {
return impl->is_multicore;
}
#ifndef YUZU_NO_CPU_DEBUGGER
bool System::DebuggerEnabled() const {
return Settings::values.use_gdbstub.GetValue();
}
@ -938,6 +949,7 @@ Core::Debugger& System::GetDebugger() {
const Core::Debugger& System::GetDebugger() const {
return *impl->debugger;
}
#endif
Network::RoomNetwork& System::GetRoomNetwork() {
return impl->room_network;

View File

@ -184,8 +184,10 @@ public:
/// Set the shutting down state.
void SetShuttingDown(bool shutting_down);
#ifndef YUZU_NO_CPU_DEBUGGER
/// Forcibly detach the debugger if it is running.
void DetachDebugger();
#endif
std::unique_lock<std::mutex> StallApplication();
void UnstallApplication();
@ -193,10 +195,12 @@ public:
void SetNVDECActive(bool is_nvdec_active);
[[nodiscard]] bool GetNVDECActive();
#ifndef YUZU_NO_CPU_DEBUGGER
/**
* Initialize the debugger.
*/
void InitializeDebugger();
#endif
/**
* Load an executable application.
@ -377,8 +381,10 @@ public:
[[nodiscard]] Service::Account::ProfileManager& GetProfileManager();
[[nodiscard]] const Service::Account::ProfileManager& GetProfileManager() const;
#ifndef YUZU_NO_CPU_DEBUGGER
[[nodiscard]] Core::Debugger& GetDebugger();
[[nodiscard]] const Core::Debugger& GetDebugger() const;
#endif
/// Gets a mutable reference to the Room Network.
[[nodiscard]] Network::RoomNetwork& GetRoomNetwork();
@ -412,8 +418,10 @@ public:
/// Tells if system is running on multicore.
[[nodiscard]] bool IsMulticore() const;
#ifndef YUZU_NO_CPU_DEBUGGER
/// Tells if the system debugger is enabled.
[[nodiscard]] bool DebuggerEnabled() const;
#endif
/// Runs a server instance until shutdown.
void RunServer(std::unique_ptr<Service::ServerManager>&& server_manager);

View File

@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/debugger/debugger.h"
#include <algorithm>
#include <mutex>
#include <thread>
@ -9,33 +11,34 @@
#include <boost/process/v1/async_pipe.hpp>
#include "common/logging/log.h"
#include "common/polyfill_thread.h"
#include "common/thread.h"
#include "core/core.h"
#include "core/debugger/debugger.h"
#include "core/debugger/debugger_interface.h"
#include "core/debugger/gdbstub.h"
#include "core/hle/kernel/global_scheduler_context.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_scheduler.h"
template <typename Readable, typename Buffer, typename Callback>
static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c) {
template<typename Readable, typename Buffer, typename Callback>
static void AsyncReceiveInto(Readable& r, Buffer& buffer, Callback&& c)
{
static_assert(std::is_trivial_v<Buffer>);
auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))};
r.async_read_some(
boost_buffer, [&, c](const boost::system::error_code& error, size_t bytes_read) {
if (!error.failed()) {
const u8* buffer_start = reinterpret_cast<const u8*>(&buffer);
std::span<const u8> received_data{buffer_start, buffer_start + bytes_read};
c(received_data);
AsyncReceiveInto(r, buffer, c);
}
});
r.async_read_some(boost_buffer,
[&, c](const boost::system::error_code& error, size_t bytes_read) {
if (!error.failed()) {
const u8* buffer_start = reinterpret_cast<const u8*>(&buffer);
std::span<const u8> received_data{buffer_start,
buffer_start + bytes_read};
c(received_data);
AsyncReceiveInto(r, buffer, c);
}
});
}
template <typename Callback>
static void AsyncAccept(boost::asio::ip::tcp::acceptor& acceptor, Callback&& c) {
template<typename Callback>
static void AsyncAccept(boost::asio::ip::tcp::acceptor& acceptor, Callback&& c)
{
acceptor.async_accept([&, c](const boost::system::error_code& error, auto&& peer_socket) {
if (!error.failed()) {
c(peer_socket);
@ -44,8 +47,9 @@ static void AsyncAccept(boost::asio::ip::tcp::acceptor& acceptor, Callback&& c)
});
}
template <typename Readable, typename Buffer>
static std::span<const u8> ReceiveInto(Readable& r, Buffer& buffer) {
template<typename Readable, typename Buffer>
static std::span<const u8> ReceiveInto(Readable& r, Buffer& buffer)
{
static_assert(std::is_trivial_v<Buffer>);
auto boost_buffer{boost::asio::buffer(&buffer, sizeof(Buffer))};
size_t bytes_read = r.read_some(boost_buffer);
@ -60,7 +64,8 @@ enum class SignalType {
ShuttingDown,
};
struct SignalInfo {
struct SignalInfo
{
SignalType type;
Kernel::KThread* thread;
const Kernel::DebugWatchpoint* watchpoint;
@ -68,17 +73,19 @@ struct SignalInfo {
namespace Core {
class DebuggerImpl : public DebuggerBackend {
class DebuggerImpl : public DebuggerBackend
{
public:
explicit DebuggerImpl(Core::System& system_, u16 port) : system{system_} {
explicit DebuggerImpl(Core::System& system_, u16 port)
: system{system_}
{
InitializeServer(port);
}
~DebuggerImpl() override {
ShutdownServer();
}
~DebuggerImpl() override { ShutdownServer(); }
bool SignalDebugger(SignalInfo signal_info) {
bool SignalDebugger(SignalInfo signal_info)
{
std::scoped_lock lk{connection_lock};
if (stopped || !state) {
@ -100,25 +107,24 @@ public:
// These functions are callbacks from the frontend, and the lock will be held.
// There is no need to relock it.
std::span<const u8> ReadFromClient() override {
std::span<const u8> ReadFromClient() override
{
return ReceiveInto(state->client_socket, state->client_data);
}
void WriteToClient(std::span<const u8> data) override {
void WriteToClient(std::span<const u8> data) override
{
boost::asio::write(state->client_socket,
boost::asio::buffer(data.data(), data.size_bytes()));
}
void SetActiveThread(Kernel::KThread* thread) override {
state->active_thread = thread;
}
void SetActiveThread(Kernel::KThread* thread) override { state->active_thread = thread; }
Kernel::KThread* GetActiveThread() override {
return state->active_thread.GetPointerUnsafe();
}
Kernel::KThread* GetActiveThread() override { return state->active_thread.GetPointerUnsafe(); }
private:
void InitializeServer(u16 port) {
void InitializeServer(u16 port)
{
using boost::asio::ip::tcp;
LOG_INFO(Debug_GDBStub, "Starting server on port {}...", port);
@ -142,7 +148,8 @@ private:
});
}
void AcceptConnection(boost::asio::ip::tcp::socket&& peer) {
void AcceptConnection(boost::asio::ip::tcp::socket&& peer)
{
LOG_INFO(Debug_GDBStub, "Accepting new peer connection");
std::scoped_lock lk{connection_lock};
@ -177,13 +184,15 @@ private:
frontend->Connected();
}
void ShutdownServer() {
void ShutdownServer()
{
connection_thread.request_stop();
io_context.stop();
connection_thread.join();
}
void PipeData(std::span<const u8> data) {
void PipeData(std::span<const u8> data)
{
std::scoped_lock lk{connection_lock};
switch (state->info.type) {
@ -197,8 +206,7 @@ private:
UpdateActiveThread();
if (state->info.type == SignalType::Watchpoint) {
frontend->Watchpoint(std::addressof(*state->active_thread),
*state->info.watchpoint);
frontend->Watchpoint(std::addressof(*state->active_thread), *state->info.watchpoint);
} else {
frontend->Stopped(std::addressof(*state->active_thread));
}
@ -220,7 +228,8 @@ private:
}
}
void ClientData(std::span<const u8> data) {
void ClientData(std::span<const u8> data)
{
std::scoped_lock lk{connection_lock};
const auto actions{frontend->ClientData(data)};
@ -262,7 +271,8 @@ private:
}
}
void PauseEmulation() {
void PauseEmulation()
{
Kernel::KScopedLightLock ll{debug_process->GetListLock()};
Kernel::KScopedSchedulerLock sl{system.Kernel()};
@ -272,7 +282,8 @@ private:
}
}
void ResumeEmulation(Kernel::KThread* except = nullptr) {
void ResumeEmulation(Kernel::KThread* except = nullptr)
{
Kernel::KScopedLightLock ll{debug_process->GetListLock()};
Kernel::KScopedSchedulerLock sl{system.Kernel()};
@ -287,13 +298,15 @@ private:
}
}
template <typename Callback>
void MarkResumed(Callback&& cb) {
template<typename Callback>
void MarkResumed(Callback&& cb)
{
stopped = false;
cb();
}
void UpdateActiveThread() {
void UpdateActiveThread()
{
Kernel::KScopedLightLock ll{debug_process->GetListLock()};
auto& threads{ThreadList()};
@ -307,13 +320,9 @@ private:
}
private:
void SetDebugProcess() {
debug_process = std::move(system.Kernel().GetProcessList().back());
}
void SetDebugProcess() { debug_process = std::move(system.Kernel().GetProcessList().back()); }
Kernel::KProcess::ThreadList& ThreadList() {
return debug_process->GetThreadList();
}
Kernel::KProcess::ThreadList& ThreadList() { return debug_process->GetThreadList(); }
private:
System& system;
@ -324,7 +333,8 @@ private:
std::jthread connection_thread;
std::mutex connection_lock;
struct ConnectionState {
struct ConnectionState
{
boost::asio::ip::tcp::socket client_socket;
boost::process::v1::async_pipe signal_pipe;
@ -338,7 +348,8 @@ private:
bool stopped{};
};
Debugger::Debugger(Core::System& system, u16 port) {
Debugger::Debugger(Core::System& system, u16 port)
{
try {
impl = std::make_unique<DebuggerImpl>(system, port);
} catch (const std::exception& ex) {
@ -348,16 +359,18 @@ Debugger::Debugger(Core::System& system, u16 port) {
Debugger::~Debugger() = default;
bool Debugger::NotifyThreadStopped(Kernel::KThread* thread) {
bool Debugger::NotifyThreadStopped(Kernel::KThread* thread)
{
return impl && impl->SignalDebugger(SignalInfo{SignalType::Stopped, thread, nullptr});
}
bool Debugger::NotifyThreadWatchpoint(Kernel::KThread* thread,
const Kernel::DebugWatchpoint& watch) {
bool Debugger::NotifyThreadWatchpoint(Kernel::KThread* thread, const Kernel::DebugWatchpoint& watch)
{
return impl && impl->SignalDebugger(SignalInfo{SignalType::Watchpoint, thread, &watch});
}
void Debugger::NotifyShutdown() {
void Debugger::NotifyShutdown()
{
if (impl) {
impl->SignalDebugger(SignalInfo{SignalType::ShuttingDown, nullptr, nullptr});
}

View File

@ -992,10 +992,12 @@ Result KProcess::Run(s32 priority, size_t stack_size) {
this->ChangeState(state);
};
#ifndef YUZU_NO_CPU_DEBUGGER
// Suspend for debug, if we should.
if (m_kernel.System().DebuggerEnabled()) {
main_thread->RequestSuspend(SuspendType::Debug);
}
#endif
// Run our thread.
R_TRY(main_thread->Run());

View File

@ -71,7 +71,9 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
// Notify the debugger and go to sleep if a step was performed
// and this thread has been scheduled again.
if (thread->GetStepState() == StepState::StepPerformed) {
#ifndef YUZU_NO_CPU_DEBUGGER
system.GetDebugger().NotifyThreadStopped(thread);
#endif
thread->RequestSuspend(SuspendType::Debug);
return;
}
@ -113,20 +115,23 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
if (breakpoint) {
interface->RewindBreakpointInstruction();
}
#ifndef YUZU_NO_CPU_DEBUGGER
if (system.DebuggerEnabled()) {
system.GetDebugger().NotifyThreadStopped(thread);
} else {
} else
#endif
interface->LogBacktrace(process);
}
thread->RequestSuspend(SuspendType::Debug);
return;
}
// Notify the debugger and go to sleep on data abort.
if (data_abort) {
#ifndef YUZU_NO_CPU_DEBUGGER
if (system.DebuggerEnabled()) {
system.GetDebugger().NotifyThreadWatchpoint(thread, *interface->HaltedWatchpoint());
}
#endif
thread->RequestSuspend(SuspendType::Debug);
return;
}

View File

@ -2,7 +2,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/core.h"
#ifndef YUZU_NO_CPU_DEBUGGER
#include "core/debugger/debugger.h"
#endif
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/svc.h"
@ -106,6 +108,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
system.CurrentPhysicalCore().LogBacktrace();
}
#ifndef YUZU_NO_CPU_DEBUGGER
const bool is_hbl = GetCurrentProcess(system.Kernel()).IsHbl();
const bool should_break = is_hbl || !notification_only;
@ -114,6 +117,7 @@ void Break(Core::System& system, BreakReason reason, u64 info1, u64 info2) {
system.GetDebugger().NotifyThreadStopped(thread);
thread->RequestSuspend(Kernel::SuspendType::Debug);
}
#endif
}
void ReturnFromException(Core::System& system, Result result) {

View File

@ -100,9 +100,11 @@ void EmuThread::run() {
m_system.GetCpuManager().OnGpuReady();
#ifndef YUZU_NO_CPU_DEBUGGER
if (m_system.DebuggerEnabled()) {
m_system.InitializeDebugger();
}
#endif
while (!stop_token.stop_requested()) {
std::unique_lock lk{m_should_run_mutex};
@ -122,7 +124,9 @@ void EmuThread::run() {
}
// Shutdown the main emulated process
#ifndef YUZU_NO_CPU_DEBUGGER
m_system.DetachDebugger();
#endif
m_system.ShutdownMainProcess();
#if MICROPROFILE_ENABLED

View File

@ -19,9 +19,14 @@ ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent)
ui->setupUi(this);
SetConfiguration();
#ifdef YUZU_NO_CPU_DEBUGGER
ui->cpu_debug_box->setEnabled(false);
ui->toggle_gdbstub->setCheckState(Qt::Unchecked);
#endif
connect(ui->open_log_button, &QPushButton::clicked, []() {
const auto path =
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir));
const auto path = QString::fromStdString(
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir));
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});

View File

@ -18,8 +18,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>842</width>
<height>741</height>
<width>829</width>
<height>758</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1">
@ -29,7 +29,7 @@
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="cpu_debug_box">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -40,7 +40,7 @@
<string>Debugger</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<property name="flat">
<bool>false</bool>
@ -59,7 +59,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
@ -355,10 +355,10 @@
<item row="10" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Policy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -452,10 +452,10 @@
<item row="7" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Policy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -501,10 +501,10 @@
<item row="5" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Policy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@ -522,7 +522,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>

View File

@ -2076,9 +2076,12 @@ bool GMainWindow::OnShutdownBegin() {
int shutdown_time = 1000;
#ifndef YUZU_NO_CPU_DEBUGGER
if (system->DebuggerEnabled()) {
shutdown_time = 0;
} else if (system->GetExitLocked()) {
} else
#endif
if (system->GetExitLocked()) {
shutdown_time = 5000;
}

View File

@ -436,13 +436,17 @@ int main(int argc, char** argv) {
#endif
void(system.Run());
#ifndef YUZU_NO_CPU_DEBUGGER
if (system.DebuggerEnabled()) {
system.InitializeDebugger();
}
#endif
while (emu_window->IsOpen()) {
emu_window->WaitEvent();
}
#ifndef YUZU_NO_CPU_DEBUGGER
system.DetachDebugger();
#endif
void(system.Pause());
system.ShutdownMainProcess();

View File

@ -16,7 +16,10 @@
"boost-icl",
"boost-intrusive",
"boost-mpl",
"boost-process",
{
"name": "boost-process",
"platform": "!android"
},
"boost-range",
"boost-spirit",
"boost-test",
@ -48,6 +51,10 @@
{
"name": "oboe",
"platform": "android"
},
{
"name": "boost-fiber",
"platform": "android"
}
]
}