Skip to content
Merged
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
5 changes: 3 additions & 2 deletions gdbjit/reader.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// SPDX-License-Identifier: MIT
#include "gdbjit.h"
#include <stdio.h>
#include <inttypes.h>

static char block_name_buffer[16];
static char block_name_buffer[2 * sizeof(uintptr_t) + 1];

static enum gdb_status read_debug_info(struct gdb_reader_funcs* self, struct gdb_symbol_callbacks* cbs, void* memory, long memory_sz)
{
gdbjit_block_t* block = (gdbjit_block_t*)memory;

struct gdb_object* object = cbs->object_open(cbs);
struct gdb_symtab* symtab = cbs->symtab_open(cbs, object, block->filename);
sprintf(block_name_buffer, "%x", block->x64start);
sprintf(block_name_buffer, "%" PRIxPTR, block->x64start);
cbs->block_open(cbs, symtab, NULL, block->start, block->end, block_name_buffer);

cbs->line_mapping_add(cbs, symtab, block->nlines, block->lines);
Expand Down
2 changes: 1 addition & 1 deletion src/libtools/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static void* pthread_routine(void* p)
#else
#define PTHREAD_ATTR_ALIGN(A) pthread_attr_t aligned_attr = {0}; if(A) memcpy(&aligned_attr, A, 56)
#define PTHREAD_ATTR_UNALIGN(A) if(A) memcpy(A, &aligned_attr, 56)
#define PTHREAD_ATTR(A) (A)?&aligned_attr:NULL
#define PTHREAD_ATTR(A) (A)?&aligned_attr:(pthread_attr_t*)(A)
#endif

EXPORT int my_pthread_attr_destroy(x64emu_t* emu, void* attr)
Expand Down
34 changes: 23 additions & 11 deletions src/wrapped32/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,8 @@ static void* findon_exitFct(void* fct)
EXPORT int my32_statvfs64(x64emu_t* emu, void* f, void* r)
{
struct statvfs s = {0};
int ret = statvfs(f, r?&s:NULL);
struct statvfs* p = r?&s:NULL;
int ret = statvfs(f, p);
if(r)
UnalignStatVFS64_32(&s, r);
return ret;
Expand All @@ -567,7 +568,8 @@ EXPORT int my32_statvfs64(x64emu_t* emu, void* f, void* r)
EXPORT int my32_statvfs(x64emu_t* emu, void* f, void* r)
{
struct statvfs s = {0};
int ret = statvfs(f, r?&s:NULL);
struct statvfs* p = r?&s:NULL;
int ret = statvfs(f, p);
if(r)
UnalignStatVFS_32(&s, r);
return ret;
Expand All @@ -576,7 +578,8 @@ EXPORT int my32_statvfs(x64emu_t* emu, void* f, void* r)
EXPORT int my32_fstatvfs64(x64emu_t* emu, int fd, void* r)
{
struct statvfs s = {0};
int ret = fstatvfs(fd, r?&s:NULL);
struct statvfs* p = r?&s:NULL;
int ret = fstatvfs(fd, p);
if(r)
UnalignStatVFS64_32(&s, r);
return ret;
Expand All @@ -585,7 +588,8 @@ EXPORT int my32_fstatvfs64(x64emu_t* emu, int fd, void* r)
EXPORT int my32_fstatvfs(x64emu_t* emu, int fd, void* r)
{
struct statvfs s = {0};
int ret = fstatvfs(fd, r?&s:NULL);
struct statvfs* p = r?&s:NULL;
int ret = fstatvfs(fd, p);
if(r)
UnalignStatVFS_32(&s, r);
return ret;
Expand All @@ -594,7 +598,8 @@ EXPORT int my32_fstatvfs(x64emu_t* emu, int fd, void* r)
EXPORT int my32_fstatat(x64emu_t* emu, int fd, void* name, void* buff, int flags)
{
struct stat64 s = {0};
int ret = fstatat64(fd, name, buff?&s:NULL, flags);
struct stat64* p = buff?&s:NULL;
int ret = fstatat64(fd, name, p, flags);
if(buff)
FillStatFromStat64(3, &s, buff);
return ret;
Expand All @@ -603,7 +608,8 @@ EXPORT int my32_fstatat(x64emu_t* emu, int fd, void* name, void* buff, int flags
EXPORT int my32_fstatat64(x64emu_t* emu, int fd, void* name, void* buff, int flags)
{
struct stat64 s = {0};
int ret = fstatat64(fd, name, buff?&s:NULL, flags);
struct stat64* p = buff?&s:NULL;
int ret = fstatat64(fd, name, p, flags);
if(buff)
UnalignStat64_32(&s, buff);
return ret;
Expand All @@ -612,7 +618,8 @@ EXPORT int my32_fstatat64(x64emu_t* emu, int fd, void* name, void* buff, int fla
EXPORT int my32___stat64_time64(x64emu_t* emu, void* f, void* r)
{
struct stat64 s = {0};
int ret = stat64(f, r?&s:NULL);
struct stat64* p = r?&s:NULL;
int ret = stat64(f, p);
if(r)
UnalignStat64_32_t64(&s, r);
return ret;
Expand All @@ -621,7 +628,8 @@ EXPORT int my32___stat64_time64(x64emu_t* emu, void* f, void* r)
EXPORT int my32___lstat64_time64(x64emu_t* emu, void* f, void* r)
{
struct stat64 s = {0};
int ret = lstat64(f, r?&s:NULL);
struct stat64* p = r?&s:NULL;
int ret = lstat64(f, p);
if(r)
UnalignStat64_32_t64(&s, r);
return ret;
Expand All @@ -630,7 +638,8 @@ EXPORT int my32___lstat64_time64(x64emu_t* emu, void* f, void* r)
EXPORT int my32___fstat64_time64(x64emu_t* emu, int fd, void* r)
{
struct stat64 s = {0};
int ret = fstat64(fd, r?&s:NULL);
struct stat64* p = r?&s:NULL;
int ret = fstat64(fd, p);
if(r)
UnalignStat64_32_t64(&s, r);
return ret;
Expand Down Expand Up @@ -1724,7 +1733,8 @@ EXPORT int32_t my32_epoll_wait(x64emu_t* emu, int32_t epfd, void* events, int32_
{
struct epoll_event _events[maxevents];
//AlignEpollEvent(_events, events, maxevents);
int32_t ret = epoll_wait(epfd, events?_events:NULL, maxevents, timeout);
struct epoll_event* ev = events?_events:NULL;
int32_t ret = epoll_wait(epfd, ev, maxevents, timeout);
if(ret>0)
UnalignEpollEvent32(events, _events, ret);
return ret;
Expand Down Expand Up @@ -2761,7 +2771,9 @@ EXPORT int my32_alphasort64(x64emu_t* emu, ptr_t* d1_, ptr_t* d2_)
const struct dirent64* d2 = NULL;
if(d1_) d1 = (struct dirent64*)from_ptrv(*d1_);
if(d2_) d2 = (struct dirent64*)from_ptrv(*d2_);
return alphasort64(d1_?(&d1):NULL, d2_?(&d2):NULL);
const struct dirent64** e1 = d1_?(&d1):NULL;
const struct dirent64** e2 = d2_?(&d2):NULL;
return alphasort64(e1, e2);
}

#ifndef ANDROID
Expand Down
Loading