Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions core/libs/prx/libc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,26 @@ if(BUILD_TESTING)
set_tests_properties(guest_demangle PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
add_test_executable(unwind_cursor_tests ${LIBS_INCLUDE_DIR}/tests/UnwindCursor.cpp)
target_include_directories(unwind_cursor_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(unwind_cursor_tests PRIVATE libc)
set_target_properties(unwind_cursor_tests PROPERTIES ENABLE_EXPORTS ON)
configure_windows_unwind(unwind_cursor_tests)
add_test(NAME unwind_cursor COMMAND unwind_cursor_tests)
set(unwindCursorTests unwind_cursor)
foreach(operation IN ITEMS get set)
add_test(NAME unwind_cursor_${operation}_register COMMAND unwind_cursor_tests ${operation}-register)
set_tests_properties(unwind_cursor_${operation}_register PROPERTIES TIMEOUT 20
PASS_REGULAR_EXPRESSION "libunwind: ${operation}Register - unsupported x86_64 register")
add_test(NAME unwind_cursor_${operation}_float_register COMMAND unwind_cursor_tests ${operation}-float-register)
set_tests_properties(unwind_cursor_${operation}_float_register PROPERTIES TIMEOUT 20
PASS_REGULAR_EXPRESSION "libunwind: ${operation}FloatRegister - no x86_64 float registers")
list(APPEND unwindCursorTests unwind_cursor_${operation}_register unwind_cursor_${operation}_float_register)
endforeach()
if(WIN32)
set_tests_properties(${unwindCursorTests} PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
add_test_executable(guest_string_tests ${LIBS_INCLUDE_DIR}/tests/GuestStrings.cpp)
target_include_directories(guest_string_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_string_tests PRIVATE libc libScePosixForWebKit)
Expand Down
12 changes: 9 additions & 3 deletions core/libs/prx/libc/include/exceptions/Unwind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ struct _Unwind_Context {
std::uintptr_t dataBase {};
std::uintptr_t personality {};
bool signalFrame {};
std::uintptr_t regionEnd {};
std::uintptr_t frameEntry {};
std::uintptr_t frameEntrySize {};
std::uintptr_t argumentsSize {};
std::uintptr_t segment {};
bool infoMissing {};
};

namespace LibcUnwind {
Expand Down Expand Up @@ -99,7 +105,7 @@ inline unsigned EncodingSize(Byte encoding) {
}
}

struct Lookup { Word pc; const Byte* fde {}; Word text {}; Word data {}; };
struct Lookup { Word pc; const Byte* fde {}; Word text {}; Word data {}; Word segment {}; };

struct Frame {
const Byte* cieBegin {};
Expand Down Expand Up @@ -172,7 +178,7 @@ constexpr unsigned RuleCount = 33;
constexpr unsigned RuleCount = 17;
#endif

struct Rules { Rule registers[RuleCount] {}; unsigned cfaRegister {7}; std::intptr_t cfaOffset {}; const Byte* cfaExpression {}; };
struct Rules { Rule registers[RuleCount] {}; unsigned cfaRegister {7}; std::intptr_t cfaOffset {}; const Byte* cfaExpression {}; Word argumentsSize {}; };

inline bool Instructions(const Byte* p, const Byte* end, const Frame& frame, Word target, Rules& state, const Rules& initial) {
Word location = frame.start;
Expand Down Expand Up @@ -221,7 +227,7 @@ inline bool Instructions(const Byte* p, const Byte* end, const Frame& frame, Wor
if (reg < RuleCount) state.registers[reg] = {unsigned(opcode == 16 ? 3 : 6), 0, expr};
break;
}
case 46: Uleb(p); break;
case 46: state.argumentsSize = Uleb(p); break;
default: return false;
}
}
Expand Down
Loading
Loading