/[pearpc]/src/tools/debug.cc
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /src/tools/debug.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Sep 5 17:11:21 2007 UTC (11 years, 10 months ago) by dpavlin
File size: 779 byte(s)
import upstream CVS
1 #include <signal.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 #include "debug.h"
6 #include "system/types.h"
7
8 extern "C" void NORETURN ht_assert_failed(const char *file, int line, const char *assertion)
9 {
10 fprintf(stderr, "in file %s, line %d: assertion failed: %s\n", file, line, assertion);
11 #ifndef WIN32
12 #if 1
13 fprintf(stderr, "sending SIGTRAP...");
14 raise(SIGTRAP);
15 #endif
16 #endif
17 exit(1);
18 }
19
20 void debugDumpMem(void *buf, int len)
21 {
22 byte *p = (byte*)buf;
23 while (len) {
24 uint w = 16;
25 uint m = w;
26 if (m>len) m = len;
27 for (uint i=0; i<m; i++) {
28 printf("%02x ", *p);
29 p++;
30 }
31 for (uint i=0; i<w-m; i++) {
32 printf(" ");
33 }
34 p-=m;
35 for (uint i=0; i<m; i++) {
36 printf("%c", ((*p < 32) || (*p > 0x80)) ? '.' : *p);
37 p++;
38 }
39 printf("\n");
40 len -= m;
41 }
42 }

  ViewVC Help
Powered by ViewVC 1.1.26