summaryrefslogtreecommitdiff
path: root/src/format/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r--src/format/symbol.c84
1 files changed, 82 insertions, 2 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 2cd4f87..9b054e6 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -30,6 +30,7 @@
#include "symbol-int.h"
+#include "../analysis/db/misc/rlestr.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
#include "../gtkext/gtkblockdisplay.h"
@@ -940,8 +941,57 @@ static void g_binary_symbol_print(GBinSymbol *symbol, GBufferLine *line, size_t
static bool _g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
+ sym_extra_data_t *extra; /* Données insérées à consulter*/
+ uleb128_t value; /* Valeur ULEB128 à charger */
+ rle_string str; /* Chaîne à charger */
- result = true;
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->stype = value;
+
+ if (result)
+ {
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->status = value;
+
+ }
+
+ if (result)
+ result = extract_packed_buffer(pbuf, &extra->nm_prefix, 1, false);
+
+ if (result)
+ {
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->flags = value;
+
+ }
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ if (result)
+ result = unpack_mrange(&symbol->range, pbuf);
+
+ if (result)
+ {
+ setup_empty_rle_string(&str);
+
+ result = unpack_rle_string(&str, pbuf);
+
+ if (result && get_rle_string(&str) != NULL)
+ symbol->alt = strdup(get_rle_string(&str));
+
+ exit_rle_string(&str);
+
+ }
return result;
@@ -993,8 +1043,38 @@ static bool g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, pa
static bool _g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
+ sym_extra_data_t *extra; /* Données insérées à consulter*/
+ rle_string str; /* Chaîne à conserver */
+
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = pack_uleb128((uleb128_t []){ extra->stype }, pbuf);
+
+ if (result)
+ result = pack_uleb128((uleb128_t []){ extra->status }, pbuf);
+
+ if (result)
+ result = extend_packed_buffer(pbuf, &extra->nm_prefix, 1, false);
+
+ if (result)
+ result = pack_uleb128((uleb128_t []){ extra->flags }, pbuf);
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ if (result)
+ result = pack_mrange(&symbol->range, pbuf);
- result = true;
+ if (result)
+ {
+ init_static_rle_string(&str, symbol->alt);
+
+ result = pack_rle_string(&str, pbuf);
+
+ exit_rle_string(&str);
+
+ }
return result;