X-Git-Url: https://www.bearssl.org/gitweb//home/git/?p=BearSSL;a=blobdiff_plain;f=src%2Fssl%2Fssl_hs_common.t0;h=dc025ffe4ed7b6956a50641aa435d417a2fdcac0;hp=962daa772e264745eb1c28eaee39a362d5b90cd8;hb=4aac1cd5c65462d5ad13e377705a00eab8c80d81;hpb=ea95d8264c6aefe742a9c3f4f9d834b188566a29;ds=sidebyside diff --git a/src/ssl/ssl_hs_common.t0 b/src/ssl/ssl_hs_common.t0 index 962daa7..dc025ff 100644 --- a/src/ssl/ssl_hs_common.t0 +++ b/src/ssl/ssl_hs_common.t0 @@ -79,6 +79,23 @@ preamble { : NYI ( -- ! ) "NOT YET IMPLEMENTED!" puts cr -1 fail ; +\ Debug function that prints a string (and a newline) on stderr. +cc: DBG ( addr -- ) { + extern void *stderr; + extern int fprintf(void *, const char *, ...); + fprintf(stderr, "%s\n", &t0_datablock[T0_POPi()]); +} + +\ Debug function that prints a string and an integer value (followed +\ by a newline) on stderr. +cc: DBG2 ( addr x -- ) { + extern void *stderr; + extern int fprintf(void *, const char *, ...); + int32_t x = T0_POPi(); + fprintf(stderr, "%s: %ld (0x%08lX)\n", + &t0_datablock[T0_POPi()], (long)x, (unsigned long)(uint32_t)x); +} + \ Mark the context as failed with a specific error code. This also \ returns control to the caller. cc: fail ( err -- ! ) {