Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ jobs:
run: ./ci_setup_test.sh

- name: Test
id: test
run: ./ci_test.sh

- name: Upload failure logs
if: ${{ always() && (steps.test.outcome == 'failure') }}
uses: actions/upload-artifact@v6
with:
name: failure-logs
path: ${{ env.DIR_TEST_DOSEMU }}/test_*

24 changes: 21 additions & 3 deletions fdpp/thunks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ void fdvprintf(const char *format, va_list vl)
fdpp->print(FDPP_PRINT_TERMINAL, format, vl);
}

static void fdlogvprintf(const char *format, va_list vl)
static void fdlogvprintf(int prio, const char *format, va_list vl)
{
fdpp->print(FDPP_PRINT_LOG, format, vl);
fdpp->print(prio, format, vl);
}

void fdprintf(const char *format, ...)
Expand All @@ -250,9 +250,27 @@ void fdprintf(const char *format, ...)
void fdlogprintf(const char *format, ...)
{
va_list vl;
int prio = FDPP_PRINT_LOG;

if (strcmp("%s", format) == 0) { // The string has been preformatted and we

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be reasonable
to demand @ in a format string
itself. I'd like to avoid va_arg() here.

const char *s; // may need to move an @ from args to format

va_start(vl, format);
s = va_arg(vl, const char *);
va_end(vl);

if (s[0] == '@') {
fdlogprintf("@%s", s + 1); // call ourselves again
return;
}
}

if (format[0] == '@') {
prio |= FDPP_PRINT_LOG_NOPREFIX;
format++;
}
va_start(vl, format);
fdlogvprintf(format, vl);
fdlogvprintf(prio, format, vl);
va_end(vl);
}

Expand Down
50 changes: 24 additions & 26 deletions hdr/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ void logprintf(const char *format, ...) PRINTF(1);

/* use to limit output to debug builds */
#ifdef DEBUG

/* enable or disable various chunks of debug output */

/* show stored IRQ vectors */
#define DEBUGIRQ
/* display output during kernel config processing phase */
#define DEBUGCFG
/* display info on various DOS functions (dosfns.c) */
#define DEBUGDOSFNS
/* extra debug output related to chdir */
#define CHDIR_DEBUG
/* extra debug output related to findfirst */
#define FIND_DEBUG
/* display info on various DOS directory functions (fatdir.c) */
#define DEBUGFATDIR
/* extra output during read/write operations */
#define DSK_DEBUG
/* display info on various FAT handling functions (fatfs.c) */
#define DEBUGFATFS
/* debug truename */
#define DEBUG_TRUENAME
/* display nls conversion */
#define NLS_DEBUG

#ifdef DEBUG_PRINT_COMPORT
#define DebugPrintf(x) dbgc_printf x
#else
Expand All @@ -61,43 +85,25 @@ void logprintf(const char *format, ...) PRINTF(1);
keep around for later use. */
#define DDebugPrintf(x)


/* enable or disable various chunks of debug output */

/* show stored IRQ vectors */
/* #define DEBUGIRQ */

/* show output related to moving kernel into HMA */
#ifdef DEBUG
#define HMAInitPrintf(x) DebugPrintf(x)
#else
#define HMAInitPrintf(x)
#endif

/* display output during kernel config processing phase */
/* #define DEBUGCFG */
#ifdef DEBUGCFG
#define CfgDbgPrintf(x) DebugPrintf(x)
#else
#define CfgDbgPrintf(x)
#endif

/* display info on various DOS functions (dosfns.c) */
/* #define DEBUGDOSFNS */
#ifdef DEBUGDOSFNS
#define DFnsDbgPrintf(x) DebugPrintf(x)
#else
#define DFnsDbgPrintf(x)
#endif

/* extra debug output related to chdir */
/* #define CHDIR_DEBUG */

/* extra debug output related to findfirst */
/* #define FIND_DEBUG */

/* display info on various DOS directory functions (fatdir.c) */
/* #define DEBUGFATDIR */
#ifdef DEBUGFATDIR
#define FDirDbgPrintf(x) DebugPrintf(x)
#else
Expand All @@ -107,26 +113,18 @@ void logprintf(const char *format, ...) PRINTF(1);
/* extra debug output when transferring I/O chunks of data */
/* #define DISPLAY_GETBLOCK */

/* extra output during read/write operations */
/* #define DSK_DEBUG */

/* display info on various FAT handling functions (fatfs.c) */
/* #define DEBUGFATFS */
#ifdef DEBUGFATFS
#define FatFSDbgPrintf(x) DebugPrintf(x)
#else
#define FatFSDbgPrintf(x)
#endif

/* debug truename */
/* #define DEBUG_TRUENAME */
#ifdef DEBUG_TRUENAME
#define tn_printf(x) DebugPrintf(x)
#else
#define tn_printf(x)
#endif


/* ensure printf is prototyped */
#if defined(DEBUG) || defined(DEBUGIRQ) || defined(DEBUGCFG) || \
defined(DEBUGDOSFNS) || defined(CHDIR_DEBUG) || defined(FIND_DEBUG) || \
Expand Down
1 change: 1 addition & 0 deletions include/fdpp/thunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ int FdppCall(struct vm86_regs *regs);
int FdppCtrl(int idx, struct vm86_regs *regs);

enum { FDPP_PRINT_LOG, FDPP_PRINT_TERMINAL, FDPP_PRINT_SCREEN };
#define FDPP_PRINT_LOG_NOPREFIX (1 << 16)
enum { ASM_CALL_OK, ASM_CALL_ABORT };
enum { FDPP_RET_ABORT = -1, FDPP_RET_OK, FDPP_RET_NORET };

Expand Down
3 changes: 2 additions & 1 deletion kernel/dosfns.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/****************************************************************/

#include "portab.h"
#include "debug.h"

#ifdef VERSION_STRINGS
static BYTE *dosfnsRcsId =
Expand Down Expand Up @@ -1126,7 +1127,7 @@ COUNT DosFindFirst(UCOUNT attr, const char FAR * name)
SAttr = (BYTE) attr;

#if defined(FIND_DEBUG)
DebugPrintf(("Remote Find: n='%Fs\n", PriPathName));
DebugPrintf(("Remote Find: n='%s\n", GET_PTR(PriPathName)));
#endif

dta = &sda_tmp_dm;
Expand Down
5 changes: 3 additions & 2 deletions kernel/dsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
/****************************************************************/

#include "portab.h"
#include "debug.h"
#include "globals.h"
#include "dyndata.h"

Expand Down Expand Up @@ -482,8 +483,8 @@ STATIC WORD getbpb(ddt FAR * pddt)
#ifdef DSK_DEBUG
DebugPrintf(("BPB_NSECS = %04x\n", pbpbarray->bpb_nsecs));
DebugPrintf(("BPB_NHEADS = %04x\n", pbpbarray->bpb_nheads));
DebugPrintf(("BPB_HIDDEN = %08lx\n", pbpbarray->bpb_hidden));
DebugPrintf(("BPB_HUGE = %08lx\n", pbpbarray->bpb_huge));
DebugPrintf(("BPB_HIDDEN = %04x\n", pbpbarray->bpb_hidden));
DebugPrintf(("BPB_HUGE = %04x\n", pbpbarray->bpb_huge));
#endif

return 0;
Expand Down
9 changes: 5 additions & 4 deletions kernel/fatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/****************************************************************/

#include "portab.h"
#include "debug.h"
#include "globals.h"

#ifdef VERSION_STRINGS
Expand Down Expand Up @@ -1135,8 +1136,8 @@ STATIC COUNT dos_extend(f_node_ptr fnp)
boff = (UWORD)(fnp->f_offset % secsize);

#ifdef DSK_DEBUG
DebugPrintf(("write %d links; dir offset %ld, cluster %d\n",
fnp->f_count, fnp->f_dmp->dm_entry, fnp->f_cluster));
DebugPrintf(("dir offset %ld, cluster %d\n",
fnp->f_dmp->dm_entry, fnp->f_cluster));
#endif

xfr_cnt = count < (ULONG) secsize - boff ?
Expand Down Expand Up @@ -1432,8 +1433,8 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode)
normal_xfer:

#ifdef DSK_DEBUG
DebugPrintf(("r/w %d links; dir offset %d, cluster %d, mode %x\n",
fnp->f_count, fnp->f_dmp->dm_entry, fnp->f_cluster, mode));
DebugPrintf(("dir offset %d, cluster %d, mode %x\n",
fnp->f_dmp->dm_entry, fnp->f_cluster, mode));
#endif

/* Get the block we need from cache */
Expand Down
6 changes: 3 additions & 3 deletions kernel/initdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,11 @@ STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)

driveParam->driveno = drive;

DebugPrintf(("drive %02Xh total: C = %u, H = %u, S = %u,",
DebugPrintf(("drive %02Xh total: C = %u, H = %u, S = %u, total size %uMB\n",
drive,
driveParam->chs.Cylinder,
driveParam->chs.Head, driveParam->chs.Sector));
DebugPrintf((" total size %uMB\n", driveParam->total_sectors / 2048));
driveParam->chs.Head, driveParam->chs.Sector,
driveParam->total_sectors / 2048));

ErrorReturn:

Expand Down
9 changes: 3 additions & 6 deletions kernel/newstuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ long DosMkTmp(char FAR * pathname, UWORD attr)
return rc;
}

#ifdef DEBUG
#define DEBUG_TRUENAME
#endif
Comment thread
andrewbird marked this conversation as resolved.

#define drLetterToNr(dr) ((unsigned char)((dr) - 'A'))
/* Convert an uppercased drive letter into the drive index */
#define drNrToLetter(dr) ((dr) + 'A')
Expand Down Expand Up @@ -321,7 +317,7 @@ COUNT truename(__XFAR(const char) src, char FAR *dest, COUNT mode)

fmemcpy(&TempCDS, cdsEntry, sizeof(struct cds));
tn_printf(("CDS entry: #%u @%P (%u) '%s'\n", result, GET_FP32(cdsEntry),
TempCDS.cdsBackslashOffset, GET_FP32(TempCDS.cdsCurrentPath)));
TempCDS.cdsBackslashOffset, GET_PTR(TempCDS.cdsCurrentPath)));
/* is the current_ldt thing necessary for compatibly??
-- 2001/09/03 ska*/
current_ldt = cdsEntry;
Expand Down Expand Up @@ -429,7 +425,8 @@ COUNT truename(__XFAR(const char) src, char FAR *dest, COUNT mode)

if (!(mode & CDS_MODE_SKIP_PHYSICAL))
{
tn_printf(("SUBSTing from: %s\n", cp));
tn_printf(("SUBSTing from: %s\n", GET_PTR(cp)));

/* What to do now: the logical drive letter will be replaced by the hidden
portion of the associated path. This is necessary for NETWORK and
SUBST drives. For local drives it should not harm.
Expand Down
25 changes: 12 additions & 13 deletions kernel/nls.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* ==ska*/

#include "portab.h"
#include "debug.h"
#include "globals.h"
#include "pcb.h"
#include "nls.h"
Expand Down Expand Up @@ -260,11 +261,10 @@ STATIC VOID upMMem(UBYTE FAR * map, UBYTE FAR * str, unsigned len)

oldStr = str;
oldLen = len;
log(("NLS: upMMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
FP_OFF(str)));
DebugPrintf(("NLS: upMMem(): len=%u, %P=\"", len, GET_FP32(str)));
for (c = 0; c < len; ++c)
DebugPrintf(("%c", str[c] > 32 ? str[c] : '.'));
DebugPrintf(("\"\n"));
DebugPrintf(("@%c", str[c] > 32 ? str[c] : '.'));
DebugPrintf(("@\"\n"));
#endif
if (len)
do
Expand All @@ -279,8 +279,8 @@ STATIC VOID upMMem(UBYTE FAR * map, UBYTE FAR * str, unsigned len)
#ifdef NLS_DEBUG
DebugPrintf(("NLS: upMMem(): result=\""));
for (c = 0; c < oldLen; ++c)
DebugPrintf(("%c", oldStr[c] > 32 ? oldStr[c] : '.'));
DebugPrintf(("\"\n"));
DebugPrintf(("@%c", oldStr[c] > 32 ? oldStr[c] : '.'));
DebugPrintf(("@\"\n"));
#endif
}

Expand Down Expand Up @@ -522,11 +522,10 @@ VOID DosUpFMem(VOID FAR * str, unsigned len)
{
#ifdef NLS_DEBUG
unsigned c;
log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
FP_OFF(str)));
DebugPrintf(("NLS: DosUpFMem(): len=%u, %P=\"", len, GET_FP32(str)));
for (c = 0; c < len; ++c)
DebugPrintf(("%c", ((char FAR *)str)[c] > 32 ? ((char FAR *)str)[c] : '.'));
DebugPrintf(("\"\n"));
DebugPrintf(("@%c", ((char FAR *)str)[c] > 32 ? ((char FAR *)str)[c] : '.'));
DebugPrintf(("@\"\n"));
#endif
if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE)
nlsFUpMem(nlsInfo.actPkg, str, len);
Expand Down Expand Up @@ -697,10 +696,10 @@ UWORD ASMCFUNC syscall_MUX14(iregs FAR * regs)
{
unsigned j;
BYTE FAR *p;
log(("NLS: MUX14(FILE_UPMEM): len=%u, %04x:%04x=\"", regs->CX, regs->ES, regs->DI));
DebugPrintf(("NLS: MUX14(FILE_UPMEM): len=%u, %04x:%04x=\"", regs->CX, regs->ES, regs->DI));
for (j = 0, p = MK_FP(regs->ES, regs->DI); j < regs->CX; ++j)
DebugPrintf(("%c", p[j] > 32 ? p[j] : '.'));
DebugPrintf(("\"\n"));
DebugPrintf(("@%c", p[j] > 32 ? p[j] : '.'));
DebugPrintf(("@\"\n"));
}
#endif
nlsFUpMem(nls, MK_FP(regs->ES, regs->DI), regs->CX);
Expand Down
Loading