mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-29 03:05:32 +02:00
[video_core, hle] remove redundant parent references in system structs (#3908)
reworked a bit to remove references of parent objects and instead pass as arguments to methods to prevent useless reloads Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: maufeat <sahyno1996@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3908 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
f8facda35f
commit
3aa0d46259
307 changed files with 4419 additions and 4477 deletions
|
|
@ -81,7 +81,10 @@ namespace Core {
|
|||
|
||||
class DebuggerImpl : public DebuggerBackend {
|
||||
public:
|
||||
explicit DebuggerImpl(Core::System& system_, u16 port) : system{system_} {
|
||||
explicit DebuggerImpl(Core::System& system_, u16 port)
|
||||
: system{system_}
|
||||
, debug_process{system_.Kernel()}
|
||||
{
|
||||
InitializeServer(port);
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +124,7 @@ public:
|
|||
}
|
||||
|
||||
void SetActiveThread(Kernel::KThread* thread) override {
|
||||
state->active_thread = thread;
|
||||
state->active_thread = {system.Kernel(), thread};
|
||||
}
|
||||
|
||||
Kernel::KThread* GetActiveThread() override {
|
||||
|
|
@ -168,14 +171,7 @@ private:
|
|||
frontend = std::make_unique<GDBStub>(*this, system, debug_process.GetPointerUnsafe());
|
||||
|
||||
// Set the new state. This will tear down any existing state.
|
||||
state = ConnectionState{
|
||||
.client_socket{std::move(peer)},
|
||||
.signal_pipe{io_context},
|
||||
.info{},
|
||||
.active_thread{},
|
||||
.client_data{},
|
||||
.pipe_data{},
|
||||
};
|
||||
state.emplace(std::move(peer), io_context, system.Kernel());
|
||||
|
||||
// Set up the client signals for new data.
|
||||
AsyncReceiveInto(state->signal_pipe, state->pipe_data, [&](auto d) { PipeData(d); });
|
||||
|
|
@ -204,7 +200,7 @@ private:
|
|||
PauseEmulation();
|
||||
|
||||
// Notify the client.
|
||||
state->active_thread = state->info.thread;
|
||||
state->active_thread = {system.Kernel(), state->info.thread};
|
||||
UpdateActiveThread();
|
||||
|
||||
if (state->info.type == SignalType::Watchpoint) {
|
||||
|
|
@ -258,7 +254,7 @@ private:
|
|||
auto* gdb = static_cast<GDBStub*>(frontend.get());
|
||||
MarkResumed([this, threads = std::move(gdb->resume_threads)] {
|
||||
state->active_thread->SetStepState(Kernel::StepState::StepPending);
|
||||
state->active_thread->Resume(Kernel::SuspendType::Debug);
|
||||
state->active_thread->Resume(system.Kernel(), Kernel::SuspendType::Debug);
|
||||
ResumeThreads(threads, state->active_thread.GetPointerUnsafe());
|
||||
});
|
||||
break;
|
||||
|
|
@ -281,7 +277,7 @@ private:
|
|||
|
||||
// Put all threads to sleep on next scheduler round.
|
||||
for (auto& thread : ThreadList()) {
|
||||
thread.RequestSuspend(Kernel::SuspendType::Debug);
|
||||
thread.RequestSuspend(system.Kernel(), Kernel::SuspendType::Debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +292,7 @@ private:
|
|||
}
|
||||
|
||||
thread.SetStepState(Kernel::StepState::NotStepping);
|
||||
thread.Resume(Kernel::SuspendType::Debug);
|
||||
thread.Resume(system.Kernel(), Kernel::SuspendType::Debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +308,7 @@ private:
|
|||
}
|
||||
|
||||
thread->SetStepState(Kernel::StepState::NotStepping);
|
||||
thread->Resume(Kernel::SuspendType::Debug);
|
||||
thread->Resume(system.Kernel(), Kernel::SuspendType::Debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +328,7 @@ private:
|
|||
return;
|
||||
}
|
||||
}
|
||||
state->active_thread = std::addressof(threads.front());
|
||||
state->active_thread = {system.Kernel(), std::addressof(threads.front())};
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -354,13 +350,20 @@ private:
|
|||
std::mutex connection_lock;
|
||||
|
||||
struct ConnectionState {
|
||||
boost::asio::ip::tcp::socket client_socket;
|
||||
#ifdef USE_BOOST_v1
|
||||
boost::process::v1::async_pipe signal_pipe;
|
||||
using async_pipe = boost::process::v1::async_pipe;
|
||||
#else
|
||||
boost::process::async_pipe signal_pipe;
|
||||
using async_pipe = boost::process::async_pipe;
|
||||
#endif
|
||||
|
||||
ConnectionState(boost::asio::ip::tcp::socket&& client_socket_, async_pipe signal_pipe_, Kernel::KernelCore& kernel)
|
||||
: client_socket{std::move(client_socket_)}
|
||||
, signal_pipe{signal_pipe_}
|
||||
, active_thread{kernel, nullptr}
|
||||
{}
|
||||
|
||||
boost::asio::ip::tcp::socket client_socket;
|
||||
async_pipe signal_pipe;
|
||||
SignalInfo info;
|
||||
Kernel::KScopedAutoObject<Kernel::KThread> active_thread;
|
||||
std::array<u8, 4096> client_data;
|
||||
|
|
|
|||
|
|
@ -323,13 +323,13 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) {
|
|||
success = true;
|
||||
break;
|
||||
case BreakpointType::WriteWatch:
|
||||
success = debug_process->InsertWatchpoint(addr, size, Kernel::DebugWatchpointType::Write);
|
||||
success = debug_process->InsertWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::Write);
|
||||
break;
|
||||
case BreakpointType::ReadWatch:
|
||||
success = debug_process->InsertWatchpoint(addr, size, Kernel::DebugWatchpointType::Read);
|
||||
success = debug_process->InsertWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::Read);
|
||||
break;
|
||||
case BreakpointType::AccessWatch:
|
||||
success = debug_process->InsertWatchpoint(addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
|
||||
success = debug_process->InsertWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
|
||||
break;
|
||||
case BreakpointType::Hardware:
|
||||
default:
|
||||
|
|
@ -368,13 +368,13 @@ void GDBStub::HandleBreakpointRemove(std::string_view sv) {
|
|||
break;
|
||||
}
|
||||
case BreakpointType::WriteWatch:
|
||||
success = debug_process->RemoveWatchpoint(addr, size, Kernel::DebugWatchpointType::Write);
|
||||
success = debug_process->RemoveWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::Write);
|
||||
break;
|
||||
case BreakpointType::ReadWatch:
|
||||
success = debug_process->RemoveWatchpoint(addr, size, Kernel::DebugWatchpointType::Read);
|
||||
success = debug_process->RemoveWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::Read);
|
||||
break;
|
||||
case BreakpointType::AccessWatch:
|
||||
success = debug_process->RemoveWatchpoint(addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
|
||||
success = debug_process->RemoveWatchpoint(system.Kernel(), addr, size, Kernel::DebugWatchpointType::ReadOrWrite);
|
||||
break;
|
||||
case BreakpointType::Hardware:
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue