diff options
Diffstat (limited to 'src/format/format.c')
-rw-r--r-- | src/format/format.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/format/format.c b/src/format/format.c index 323e006..63c4deb 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -310,6 +310,7 @@ static void _g_binary_format_remove_symbol(GBinFormat *format, size_t index) /** * TODO : envoyer un signal pour avertir les opérandes concernées. + * TODO : vérifier les conditions d'accès (verrou). */ symbol = format->symbols[index]; @@ -601,6 +602,8 @@ bool g_binary_format_find_symbol_by_label(const GBinFormat *format, const char * result = false; + g_rw_lock_reader_lock(&format->syms_lock); + for (i = 0; i < format->symbols_count && !result; i++) { cur_lbl = g_binary_symbol_get_label(format->symbols[i]); @@ -617,6 +620,8 @@ bool g_binary_format_find_symbol_by_label(const GBinFormat *format, const char * } + g_rw_lock_reader_unlock(&format->syms_lock); + return result; } @@ -646,8 +651,12 @@ static bool _g_binary_format_find_symbol(const GBinFormat *format, const vmpa2t *symbol = NULL; /* TODO : vérifier les doublons côtés appelants */ + g_rw_lock_reader_lock(&format->syms_lock); + found = bsearch(addr, format->symbols, format->symbols_count, sizeof(GBinSymbol *), fn); + g_rw_lock_reader_unlock(&format->syms_lock); + if (found != NULL) { *symbol = *(GBinSymbol **)found; @@ -756,6 +765,10 @@ bool g_binary_format_find_next_symbol_at(const GBinFormat *format, const vmpa2t *symbol = NULL; + g_rw_lock_reader_lock(&format->syms_lock); + + /* TODO : ajouter un peu de dichotomie ici ! */ + for (i = 0; i < format->symbols_count && !result; i++) { range = g_binary_symbol_get_range(format->symbols[i]); @@ -771,6 +784,8 @@ bool g_binary_format_find_next_symbol_at(const GBinFormat *format, const vmpa2t } + g_rw_lock_reader_unlock(&format->syms_lock); + return result; } |