summaryrefslogtreecommitdiff
path: root/src/analysis/db/items
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-06 18:48:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-06 18:48:16 (GMT)
commit12b8a066d1d8dd8cbef587dc6fafed870604f49f (patch)
tree3eb6cfbab886b430a8479fda9a721f75ae806a4d /src/analysis/db/items
parent0320d85e480882c58f254640a54c6c6e190dbf47 (diff)
Locked access to instruction operands when needed.
Diffstat (limited to 'src/analysis/db/items')
-rw-r--r--src/analysis/db/items/switcher.c10
-rw-r--r--src/analysis/db/items/switcher.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c
index 01c1910..9cd2a2e 100644
--- a/src/analysis/db/items/switcher.c
+++ b/src/analysis/db/items/switcher.c
@@ -264,7 +264,7 @@ static void g_db_switcher_finalize(GDbSwitcher *switcher)
* *
******************************************************************************/
-GDbSwitcher *g_db_switcher_new(const GArchInstruction *instr, const GImmOperand *imm, ImmOperandDisplay display)
+GDbSwitcher *g_db_switcher_new(GArchInstruction *instr, const GImmOperand *imm, ImmOperandDisplay display)
{
GDbSwitcher *result; /* Instance à retourner */
size_t count; /* Nombre d'opérandes à visiter*/
@@ -273,12 +273,16 @@ GDbSwitcher *g_db_switcher_new(const GArchInstruction *instr, const GImmOperand
/* Recherche de la position de l'opérande */
- count = g_arch_instruction_count_operands(instr);
+ g_arch_instruction_lock_operands(instr);
+
+ count = _g_arch_instruction_count_operands(instr);
for (i = 0; i < count; i++)
- if (G_ARCH_OPERAND(imm) == g_arch_instruction_get_operand(instr, i))
+ if (G_ARCH_OPERAND(imm) == _g_arch_instruction_get_operand(instr, i))
break;
+ g_arch_instruction_unlock_operands(instr);
+
if (i == count)
return NULL;
diff --git a/src/analysis/db/items/switcher.h b/src/analysis/db/items/switcher.h
index d155a13..7fda6d7 100644
--- a/src/analysis/db/items/switcher.h
+++ b/src/analysis/db/items/switcher.h
@@ -57,7 +57,7 @@ typedef struct _GDbSwitcherClass GDbSwitcherClass;
GType g_db_switcher_get_type(void);
/* Crée une définition d'un signet dans une zone de texte. */
-GDbSwitcher *g_db_switcher_new(const GArchInstruction *, const GImmOperand *, ImmOperandDisplay);
+GDbSwitcher *g_db_switcher_new(GArchInstruction *, const GImmOperand *, ImmOperandDisplay);
#if 0
/* Fournit l'adresse associée à un signet. */