From: John Tsiombikas Date: Sun, 31 Jan 2021 19:08:33 +0000 (+0200) Subject: - fixed endianess bug in printf X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=lugburz;a=commitdiff_plain;h=fe302bc16e0daf7fc933d76f802d008c7f541f55 - fixed endianess bug in printf - added memdump function - added script to start a pty connected to the emulator --- diff --git a/src/amiga/libc/stdio.c b/src/amiga/libc/stdio.c index c404a52..9617a0c 100644 --- a/src/amiga/libc/stdio.c +++ b/src/amiga/libc/stdio.c @@ -104,7 +104,7 @@ static int intern_printf(char *buf, size_t sz, const char *fmt, va_list ap) int base = 10; int alt = 0; int fwidth = 0; - int padc = ' '; + char padc = ' '; int sign = 0; int left_align = 0; /* not implemented yet */ int hex_caps = 0; @@ -157,7 +157,7 @@ static int intern_printf(char *buf, size_t sz, const char *fmt, va_list ap) slen = strlen(conv_buf); for(i=slen; ichipmem_top); + + printf("memlist head node:\n"); + memdump(execbase->memlist.head, sizeof(struct alib_memnode)); + printf("Memory ranges:\n"); mem = execbase->memlist.head; while(mem->n_next) { diff --git a/src/debug.c b/src/debug.c new file mode 100644 index 0000000..00482f4 --- /dev/null +++ b/src/debug.c @@ -0,0 +1,32 @@ +#include +#include +#include "debug.h" + +void memdump(void *ptr, int len) +{ + int i; + unsigned char *p = ptr; + + while(len > 0) { + printf("%06lx ", (unsigned long)p); + for(i=0; i<16; i++) { + if(len - i <= 0) { + printf(" "); + } else { + printf(" %02x", (unsigned int)p[i]); + } + if((i & 7) == 7) putchar(' '); + } + printf(" |"); + for(i=0; i<16; i++) { + if(len - i <= 0) { + putchar(' '); + } else { + putchar(isprint(p[i]) ? p[i] : '.'); + } + } + printf("|\n"); + len -= 16; + p += 16; + } +} diff --git a/src/debug.h b/src/debug.h new file mode 100644 index 0000000..51386cd --- /dev/null +++ b/src/debug.h @@ -0,0 +1,6 @@ +#ifndef DEBUG_H_ +#define DEBUG_H_ + +void memdump(void *ptr, int len); + +#endif /* DEBUG_H_ */ diff --git a/uaeterm b/uaeterm new file mode 100755 index 0000000..4ea9e2e --- /dev/null +++ b/uaeterm @@ -0,0 +1,9 @@ +#!/bin/sh + +port=`cat fs-uae.conf | grep serial_port | awk '{ print $3; }'` +if [ -z "$port" ]; then + echo "fs-uae.conf doesn't include a serial_port config option" + exit 1 +fi + +socat pty,raw,echo=0,link=$port -,raw,echo=0