summaryrefslogtreecommitdiff
path: root/src/arch/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/raw.c')
-rw-r--r--src/arch/raw.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/arch/raw.c b/src/arch/raw.c
index f22645f..9d9b8de 100644
--- a/src/arch/raw.c
+++ b/src/arch/raw.c
@@ -464,10 +464,12 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
phys_t max_displayed_len; /* Quantité de code affichée */
const char *key; /* Mot clef principal */
size_t klen; /* Taille de ce mot clef */
+ size_t count; /* Nombre d'opérandes en place */
char *string; /* Chaîne reconstituée */
size_t iter; /* Tête d'écriture */
bool first; /* Mémorise une énumération */
size_t i; /* Boucle de parcours */
+ GArchOperand *op; /* Opérande à manipuler */
char byte; /* Octet à afficher (ou pas) */
bool status; /* Bilan d'une récupération */
@@ -505,18 +507,22 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
else if (instr->is_string)
{
- string = (char *)calloc(base->operands_count + 3, sizeof(char));
+ g_arch_instruction_lock_operands(base);
+
+ count = _g_arch_instruction_count_operands(base);
+
+ string = (char *)calloc(count + 3, sizeof(char));
strcpy(string, "\"");
iter = 1;
first = true;
- g_arch_instruction_lock_operands(base);
-
- for (i = 0; i < base->operands_count; i++)
+ for (i = 0; i < count; i++)
{
- status = g_imm_operand_get_value(G_IMM_OPERAND(base->operands[i]), MDS_8_BITS, &byte);
+ op = _g_arch_instruction_get_operand(base, i);
+
+ status = g_imm_operand_get_value(G_IMM_OPERAND(op), MDS_8_BITS, &byte);
assert(status);
/* Si le caractère doit apparaître en hexadécimal... */
@@ -551,7 +557,7 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
else
first = false;
- g_arch_operand_print(base->operands[i], line, 0/*, syntax*/);
+ g_arch_operand_print(op, line, 0/*, syntax*/);
}
@@ -587,16 +593,21 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
{
g_arch_instruction_lock_operands(base);
- if (base->operands_count > 0)
+ count = _g_arch_instruction_count_operands(base);
+
+ if (count > 0)
{
- g_arch_operand_print(base->operands[0], line, 0/*syntax*/);
+ op = _g_arch_instruction_get_operand(base, 0);
+ g_arch_operand_print(op, line, 0/*syntax*/);
- for (i = 1; i < base->operands_count; i++)
+ for (i = 1; i < count; i++)
{
g_buffer_line_append_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT, NULL);
g_buffer_line_append_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW, NULL);
- g_arch_operand_print(base->operands[i], line, 0/*syntax*/);
+ op = _g_arch_instruction_get_operand(base, i);
+
+ g_arch_operand_print(op, line, 0/*syntax*/);
}