summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-09-21 22:23:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-09-21 22:23:47 (GMT)
commit76fb13178cf6be94b8e01675b37f7cb1b92f7709 (patch)
treea6e6bbc6dde169add608097ceb5658fcb904bd08 /src/analysis/disass
parentdfe76faf21e254c02c86a1b0b1f8ca8fc07fe027 (diff)
Defined lock mechanism for buffer caches.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/block.c9
-rw-r--r--src/analysis/disass/disassembler.c4
-rw-r--r--src/analysis/disass/output.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/analysis/disass/block.c b/src/analysis/disass/block.c
index a141d68..ea1441f 100644
--- a/src/analysis/disass/block.c
+++ b/src/analysis/disass/block.c
@@ -574,12 +574,17 @@ static char *g_basic_block_build_tooltip(const GBasicBlock *block)
if (label != NULL)
{
cache = g_buffer_cache_new(NULL, DLC_COUNT, DLC_ASSEMBLY_LABEL);
+
+ g_buffer_cache_wlock(cache);
+
g_buffer_cache_append(cache, G_LINE_GENERATOR(symbol), BLF_NONE);
line = g_buffer_cache_find_line_by_index(cache, 0);
name = g_buffer_line_get_text(line, DLC_ASSEMBLY_LABEL, DLC_COUNT, true);
g_object_unref(G_OBJECT(line));
+ g_buffer_cache_wunlock(cache);
+
g_object_unref(G_OBJECT(cache));
/* Suppression de la fin de l'étiquette... */
@@ -640,6 +645,8 @@ static char *g_basic_block_build_tooltip(const GBasicBlock *block)
proc = g_loaded_binary_get_processor(block->binary);
cache = g_loaded_binary_get_disassembly_cache(block->binary);
+ g_buffer_cache_rlock(cache);
+
iter = g_arch_processor_get_iter_from_address(proc, get_mrange_addr(&range));
if (iter == NULL) goto no_iter;
@@ -789,6 +796,8 @@ static char *g_basic_block_build_tooltip(const GBasicBlock *block)
no_iter:
+ g_buffer_cache_runlock(cache);
+
g_object_unref(G_OBJECT(cache));
g_object_unref(G_OBJECT(proc));
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index 0b81180..4056c59 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -413,6 +413,8 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS
g_width_tracker_set_column_min_width(tracker, DLC_ASSEMBLY_LABEL, offset);
g_object_unref(G_OBJECT(tracker));
+ g_buffer_cache_wlock(*cache);
+
/**
* Impression du prologue.
*/
@@ -468,6 +470,8 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS
* Nettoyage avant sortie.
*/
+ g_buffer_cache_wunlock(*cache);
+
g_object_unref(G_OBJECT(lang));
g_object_unref(G_OBJECT(content));
g_object_unref(G_OBJECT(format));
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index f2e423c..ffff64a 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -324,7 +324,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
if (compared >= 0)
{
if (compared == 0)
- g_db_item_apply(G_DB_ITEM(comment), binary);
+ /* FIXME *** g_db_item_apply(G_DB_ITEM(comment), binary) */;
else
log_variadic_message(LMT_BAD_BINARY,