XINU
Macros | Functions
debug.h File Reference

デバッグに用いる定数や関数の宣言 More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEBUG_ASCII   0x01
 メモリ内容の出力時にASCIIとして出力する指定 More...
 
#define DEBUG_HEX   0x02
 メモリ内容の出力時に16進数として出力する指定 More...
 

Functions

void debugbreak (void)
 debugbreak()の宣言(実装がない) More...
 
void debugret (void)
 debugret()の宣言(実装がない) More...
 
void hexdump (void *buffer, uint32 length, bool8 text)
 メモリ内容をダンプするhexdump()の宣言 More...
 

Detailed Description

デバッグに用いる定数や関数の宣言

Definition in file debug.h.

Macro Definition Documentation

◆ DEBUG_ASCII

#define DEBUG_ASCII   0x01

メモリ内容の出力時にASCIIとして出力する指定

Definition at line 6 of file debug.h.

Referenced by hexdump(), and hexdump_print().

◆ DEBUG_HEX

#define DEBUG_HEX   0x02

メモリ内容の出力時に16進数として出力する指定

Definition at line 8 of file debug.h.

Referenced by hexdump(), and hexdump_print().

Function Documentation

◆ debugbreak()

void debugbreak ( void  )

debugbreak()の宣言(実装がない)

◆ debugret()

void debugret ( void  )

debugret()の宣言(実装がない)

◆ hexdump()

void hexdump ( void *  buffer,
uint32  length,
bool8  canon 
)

メモリ内容をダンプするhexdump()の宣言

メモリ内容をダンプするhexdump()の宣言

Parameters
[in]bufferダンプしたいメモリ領域の開始アドレス
[in]lengthメモリ領域の長さ(byte)
[in]canon16進数とASCIIを出力する場合はTRUE、16進数のみの場合はFALSEを指定する。
Note
char test[128] = "abcdefghijklmnopqrstuvwxyz";をダンプした例を以下に示す。
076b08b0 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 |abcdefghijklmnop|
076b08c0 71 72 73 74 75 76 77 78 79 7a 00 00 00 00 00 00 |qrstuvwxyz......|
076b08d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
076b08e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
076b08f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
076b0900 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
076b0910 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
076b0920 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
※ ASCIIを出力しない設定の場合は、右側の| |で囲まれた部分は出力されない。

Definition at line 54 of file debug.c.

References DEBUG_ASCII, DEBUG_HEX, fprintf(), hexdump_print(), stdout, and TRUE.

55 {
56  uint32 m, n, remain;
57 
58  byte *b = (byte *)buffer;
59 
60  for (n = 0; n < length; n += 0x10)
61  {
62  fprintf(stdout, "%08x ", (uint32)buffer + n);
63 
64  remain = length - n;
65 
66  for (m = 0; m < remain && m < 0x10; m++)
67  {
68  if (m % 0x08 == 0)
69  {
70  fprintf(stdout, " ");
71  }
72  hexdump_print(b[n + m], DEBUG_HEX);
73  }
74 
75  /* Pad the rest if needed */
76  if (remain < 0x10)
77  {
78  for (m = 0; m < 0x10 - remain; m++)
79  {
80  if ((0 != m) && (0 == m % 0x08))
81  {
82  fprintf(stdout, " ");
83  }
84  fprintf(stdout, " ");
85  }
86  }
87 
88  if (canon == TRUE)
89  {
90  fprintf(stdout, " |");
91  for (m = 0; m < remain && m < 0x10; m++)
92  {
93  hexdump_print(b[n + m], DEBUG_ASCII);
94  }
95  fprintf(stdout, "|");
96  }
97  fprintf(stdout, "\n");
98  }
99 }
#define DEBUG_ASCII
メモリ内容の出力時にASCIIとして出力する指定
Definition: debug.h:6
unsigned char byte
符号なし8ビット値(unsigned char)
Definition: kernel.h:7
#define DEBUG_HEX
メモリ内容の出力時に16進数として出力する指定
Definition: debug.h:8
#define stdout
Definition: stdio.h:16
#define TRUE
Boolean True(1)
Definition: kernel.h:65
static void hexdump_print(byte, byte)
ByteをASCIIか16進数でSTDOUT(標準出力)に出力する。
Definition: debug.c:19
int32 fprintf(int, char *,...)
Definition: fprintf.c:14
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
Here is the call graph for this function: