debug.h: use `uint8_t` instead of `char` for BER compressed binary.
MODIFY
include/mruby/debug.h
include/mruby/debug.h
@@ -34,7 +34,7 @@ typedef struct mrb_irep_debug_info_file {
void *ptr;
uint16_t *ary;
mrb_irep_debug_info_line *flat_map;
- char *packed_map;
+ uint8_t *packed_map;
} lines;
} mrb_irep_debug_info_file;

MODIFY
mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
#define MRB_DEBUG_BP_LINENO_OK (0x0002)
static uint32_t
-packed_int_decode(char *p, char **newpos)
+packed_int_decode(uint8_t *p, uint8_t **newpos)
{
size_t i = 0, shift = 0;
uint32_t n = 0;
@@ -60,8 +60,8 @@ check_lineno(mrb_irep_debug_info_file *info_file, uint16_t lineno)
case mrb_debug_line_packed_map:
{
- char *p = info_file->lines.packed_map;
- char *pend = p + count;
+ uint8_t *p = info_file->lines.packed_map;
+ uint8_t *pend = p + count;
uint32_t line = 0;
while (p < pend) {
packed_int_decode(p, &p);

MODIFY
src/cdump.c
src/cdump.c
@@ -311,7 +311,7 @@ cdump_debug(mrb_state *mrb, const char *name, int n, mrb_irep_debug_info *info,
case mrb_debug_line_packed_map:
line_type = "mrb_debug_line_packed_map";
fprintf(fp, "static char %s_debug_lines_%d[] = \"", name, n);
- char *pmap = info->files[0]->lines.packed_map;
+ uint8_t *pmap = info->files[0]->lines.packed_map;
for (i=0; i<len; i++) {
fprintf(fp, "\\x%02x", pmap[i]&0xff);
}

MODIFY
src/debug.c
src/debug.c
@@ -48,7 +48,7 @@ packed_int_len(uint32_t num)
}
static size_t
-packed_int_encode(uint32_t num, char *p, char *pend)
+packed_int_encode(uint32_t num, uint8_t *p, uint8_t *pend)
{
size_t llen = 0;
@@ -64,7 +64,7 @@ packed_int_encode(uint32_t num, char *p, char *pend)
}
static uint32_t
-packed_int_decode(char *p, char **newpos)
+packed_int_decode(uint8_t *p, uint8_t **newpos)
{
size_t i = 0, shift = 0;
uint32_t n = 0;
@@ -158,8 +158,8 @@ mrb_debug_get_line(mrb_state *mrb, const mrb_irep *irep, uint32_t pc)
}
case mrb_debug_line_packed_map: {
- char *p = f->lines.packed_map;
- char *pend = p + f->line_entry_count;
+ uint8_t *p = f->lines.packed_map;
+ uint8_t *pend = p + f->line_entry_count;
uint32_t pos = 0, line = 0, line_diff;
while (p < pend) {
pos += packed_int_decode(p, &p);
@@ -265,7 +265,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep_debug_info *d,
uint32_t prev_line = 0;
uint32_t prev_pc = 0;
size_t packed_size = 0;
- char *p, *pend;
+ uint8_t *p, *pend;
for (i = 0; i < file_pc_count; ++i) {
if (lines[start_pos + i] == prev_line) { continue; }
@@ -275,7 +275,7 @@ mrb_debug_info_append_file(mrb_state *mrb, mrb_irep_debug_info *d,
packed_size += packed_int_len(lines[start_pos+i]-prev_line);
prev_line = lines[start_pos + i];
}
- p = f->lines.packed_map = (char*)mrb_malloc(mrb, packed_size);
+ p = f->lines.packed_map = (uint8_t*)mrb_malloc(mrb, packed_size);
pend = p + packed_size;
prev_line = 0; prev_pc = 0;
for (i = 0; i < file_pc_count; ++i) {

debug.h: use `uint8_t` instead of `char` for BER compressed binary.