orbis: improve fd tracing
Some checks are pending
Formatting check / formatting-check (push) Waiting to run
Build RPCSX / build-linux (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.1-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.2-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.4-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.5-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9.1-a) (push) Waiting to run
Build RPCSX / build-android (x86_64, x86-64) (push) Waiting to run

This commit is contained in:
DH 2025-12-03 21:06:11 +03:00
parent 7c3ee53d6e
commit 566ad3edd8
10 changed files with 100 additions and 34 deletions

View file

@ -1,11 +1,12 @@
#include "IoDevice.hpp"
#include "file.hpp"
#include "rx/Mappable.hpp"
#include "rx/format-base.hpp"
#include "thread/Thread.hpp"
#include "utils/Logs.hpp"
#include "vmem.hpp"
static std::string iocGroupToString(unsigned iocGroup) {
std::string orbis::ioctl::groupToString(unsigned iocGroup) {
if (iocGroup >= 128) {
const char *sceGroups[] = {
"DEV",
@ -86,10 +87,14 @@ orbis::IoDevice::map(rx::AddressRange range, std::int64_t offset,
orbis::ErrorCode orbis::IoDevice::ioctl(std::uint64_t request,
orbis::ptr<void> argp, Thread *thread) {
auto group = iocGroupToString(ioctl::group(request));
auto group = ioctl::groupToString(ioctl::group(request));
auto paramSize = ioctl::paramSize(request);
ORBIS_LOG_ERROR("unhandled ioctl", request, group, paramSize, argp,
thread->tid);
thread->where();
return ErrorCode::NOTSUP;
}
std::string orbis::IoDevice::toString() const {
return rx::format("{}", static_cast<const void *>(this));
}

View file

@ -106,7 +106,7 @@ struct WrapImpl<Fn> {
sysent result;
result.narg = sizeof...(Args);
result.call = &WrapImpl::call;
result.format = [](uint64_t *values) -> std::string {
result.format = [](Thread *thread, uint64_t *values) -> std::string {
std::string result = getSysentName(&WrapImpl::call);
result += "(";
@ -134,7 +134,9 @@ struct WrapImpl<Fn> {
} else if constexpr (std::is_pointer_v<type>) {
result += rx::format("{}", (void *)value);
// using pointee = std::remove_cvref_t<std::remove_pointer_t<type>>;
// using pointee =
// std::remove_cvref_t<std::remove_pointer_t<type>>;
//
// if constexpr (requires(rx::format_parse_context &ctx) {
// rx::formatter<pointee>().parse(ctx);
// }) {
@ -149,6 +151,27 @@ struct WrapImpl<Fn> {
// }
// }
// }
} else if constexpr (std::is_same_v<type, FileDescriptor>) {
result += rx::format("{}", std::to_underlying(value));
if (std::to_underlying(value) >= 0) {
auto file = thread->tproc->fileDescriptors.get(value);
result += " (";
if (file) {
if (file->ops && file->ops->toString) {
result += file->ops->toString(file.get(), thread);
} else if (file->device) {
result += file->device->toString();
} else {
result += "<null device>";
}
} else {
result += "<invalid fd>";
}
result += ")";
}
} else if constexpr (requires(rx::format_parse_context &ctx) {
rx::formatter<type>().parse(ctx);
}) {