sbtools: be more verbose on debug and fix a bug (uninitialized structure)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29867 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6034978c84
commit
a29ef617f3
2 changed files with 18 additions and 0 deletions
|
@ -359,6 +359,7 @@ bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read,
|
|||
elf_printf_fn_t printf, void *user)
|
||||
{
|
||||
#define error_printf(...) ({printf(user, true, __VA_ARGS__); return false;})
|
||||
|
||||
/* read header */
|
||||
Elf32_Ehdr ehdr;
|
||||
if(!read(user, 0, &ehdr, sizeof(ehdr)))
|
||||
|
|
|
@ -111,6 +111,8 @@ static key_array_t read_keys(const char *key_file, int *num_keys)
|
|||
bugp("reading key file");
|
||||
close(fd);
|
||||
|
||||
if(g_debug)
|
||||
printf("Parsing key file '%s'...\n", key_file);
|
||||
*num_keys = size ? 1 : 0;
|
||||
char *ptr = buf;
|
||||
/* allow trailing newline at the end (but no space after it) */
|
||||
|
@ -137,6 +139,13 @@ static key_array_t read_keys(const char *key_file, int *num_keys)
|
|||
bugp(" invalid key, it should be a 128-bit key written in hexadecimal\n");
|
||||
keys[i][j] = (a << 4) | b;
|
||||
}
|
||||
if(g_debug)
|
||||
{
|
||||
printf("Add key: ");
|
||||
for(int j = 0; j < 16; j++)
|
||||
printf("%02x", keys[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
pos += 32;
|
||||
}
|
||||
free(buf);
|
||||
|
@ -376,6 +385,8 @@ static struct cmd_file_t *read_command_file(const char *file)
|
|||
bugp("reading command file");
|
||||
close(fd);
|
||||
|
||||
if(g_debug)
|
||||
printf("Parsing command file '%s'...\n", file);
|
||||
struct cmd_file_t *cmd_file = xmalloc(sizeof(struct cmd_file_t));
|
||||
memset(cmd_file, 0, sizeof(struct cmd_file_t));
|
||||
|
||||
|
@ -397,6 +408,7 @@ static struct cmd_file_t *read_command_file(const char *file)
|
|||
if(lexem.type == LEX_RBRACE)
|
||||
break;
|
||||
struct cmd_source_t *src = xmalloc(sizeof(struct cmd_source_t));
|
||||
memset(src, 0, sizeof(struct cmd_source_t));
|
||||
src->next = cmd_file->source_list;
|
||||
if(lexem.type != LEX_IDENTIFIER)
|
||||
bug("invalid command file: identifier expected in sources");
|
||||
|
@ -562,6 +574,8 @@ static void load_elf_by_id(struct cmd_file_t *cmd_file, const char *id)
|
|||
int fd = open(src->filename, O_RDONLY);
|
||||
if(fd < 0)
|
||||
bug("cannot open '%s' (id '%s')\n", src->filename, id);
|
||||
if(g_debug)
|
||||
printf("Loading ELF file '%s'...\n", src->filename);
|
||||
elf_init(&src->elf);
|
||||
src->elf_loaded = elf_read_file(&src->elf, elf_read, elf_printf, &fd);
|
||||
close(fd);
|
||||
|
@ -573,6 +587,9 @@ static struct sb_file_t *apply_cmd_file(struct cmd_file_t *cmd_file)
|
|||
{
|
||||
struct sb_file_t *sb = xmalloc(sizeof(struct sb_file_t));
|
||||
memset(sb, 0, sizeof(struct sb_file_t));
|
||||
|
||||
if(g_debug)
|
||||
printf("Applying command file...\n");
|
||||
/* count sections */
|
||||
struct cmd_section_t *csec = cmd_file->section_list;
|
||||
while(csec)
|
||||
|
|
Loading…
Reference in a new issue