Parse disasm option -U/u

This commit is contained in:
stefanrueger
2025-05-24 20:06:37 +02:00
parent 221389357a
commit 7344a2d3aa
2 changed files with 9 additions and 1 deletions

View File

@@ -1461,7 +1461,7 @@ typedef enum {
typedef struct {
// Flags how to display lines
int gcc_source, addresses, opcode_bytes, comments, sreg_flags, cycles;
int op_names, op_explanations, avrgcc_style, labels;
int op_names, op_explanations, avrgcc_style, labels, unused_labels;
int avrlevel; // Eg, PART_AVR_XM or PART_AVR_51 (describes opcodes for the part)
char *tagfile; // Maps addresses to labels, PGM data, memory and I/O variables
} Dis_options;

View File

@@ -229,6 +229,8 @@ static int disasm_ison(char c) {
return !!cx->dis_opts.avrgcc_style;
case 'l':
return !!cx->dis_opts.labels;
case 'u':
return !!cx->dis_opts.unused_labels;
case 'd':
return cx->dis_opts.avrlevel == (PART_ALL | OP_AVR_ILL);
}
@@ -286,6 +288,7 @@ static unsigned char *readbuf(const PROGRAMMER *pgm, const AVRPART *p, int argc,
{{'e', 'E'}, {"put explanation into comment", "do not show explanation"}},
{{'s', 'S'}, {"use avr-gcc code style", "use AVR instruction set style"}},
{{'l', 'L'}, {"preprocess jump/call labels", "do not preprocess labels"}},
{{'u', 'U'}, {"show unused tagged labels", "do not show unused labels"}},
{{'d', 'D'}, {"decode all opcodes", "decode only opcodes for the part"}},
};
@@ -517,6 +520,7 @@ static int cmd_disasm(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
cx->dis_opts.op_explanations = 0;
cx->dis_opts.avrgcc_style = 1;
cx->dis_opts.labels = 1;
cx->dis_opts.unused_labels = 1;
cx->dis_opts.tagfile = NULL;
cx->dis_opts.avrlevel = avr_get_archlevel(p);
disasm_init(p);
@@ -581,6 +585,10 @@ static int cmd_disasm(const PROGRAMMER *pgm, const AVRPART *p, int argc, const c
case 'L':
cx->dis_opts.labels = !!islower(chr);
break;
case 'u':
case 'U':
cx->dis_opts.unused_labels = !!islower(chr);
break;
case 'z':
disasm_zap_jumpcalls();
break;