summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-04-12 22:25:43 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-04-12 22:25:43 (GMT)
commit8d4c5ae6dfd812b753109a25d7e84f7e524d4bf0 (patch)
treeb437de37b5447daa02263901aca4ef7a7d2d0386 /src/format
parentb4cbeedf6ed4e04dd85c92e8345b4cb8dcaab27d (diff)
Improved support of type prefix for symbols.
Diffstat (limited to 'src/format')
-rw-r--r--src/format/symbol-int.h3
-rw-r--r--src/format/symbol.c64
-rw-r--r--src/format/symbol.h10
3 files changed, 74 insertions, 3 deletions
diff --git a/src/format/symbol-int.h b/src/format/symbol-int.h
index 77ffd39..5e77a4d 100644
--- a/src/format/symbol-int.h
+++ b/src/format/symbol-int.h
@@ -41,6 +41,9 @@ typedef union _sym_obj_extra
{
SymbolType stype; /* Type du symbole */
SymbolStatus status; /* Visibilité du symbole */
+
+ char nm_prefix; /* Eventuel préfixe "nm" */
+
SymbolFlag flags; /* Informations complémentaires*/
};
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 7d272ce..abf284e 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -549,7 +549,7 @@ SymbolFlag g_binary_symbol_get_flags(const GBinSymbol *symbol)
g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
- result = extra->flags;
+ result = (extra->flags & SFL_MASK);
g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
@@ -561,6 +561,68 @@ SymbolFlag g_binary_symbol_get_flags(const GBinSymbol *symbol)
/******************************************************************************
* *
* Paramètres : symbol = symbole à venir consulter. *
+* prefix = éventuel préfixe à constituer. [OUT] *
+* *
+* Description : Fournit le préfixe compatible avec une sortie "nm". *
+* *
+* Retour : true si un préfixe "nm" est renseigné. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_binary_symbol_get_nm_prefix(const GBinSymbol *symbol, char *prefix)
+{
+ bool result; /* Validité à retourner */
+ sym_obj_extra *extra; /* Données insérées à modifier */
+
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+
+ result = (extra->flags & SFL_HAS_NM_PREFIX);
+
+ if (result)
+ *prefix = extra->nm_prefix;
+
+ g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+
+ return result;
+
+}
+
+/******************************************************************************
+* *
+* Paramètres : symbol = symbole à venir consulter. *
+* prefix = préfixe "nm" à associer au symbole. *
+* *
+* Description : Définit le préfixe compatible avec une sortie "nm". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_binary_symbol_set_nm_prefix(const GBinSymbol *symbol, char prefix)
+{
+ sym_obj_extra *extra; /* Données insérées à modifier */
+
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
+
+ extra->nm_prefix = prefix;
+ extra->flags |= SFL_HAS_NM_PREFIX;
+
+ g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : symbol = symbole à venir consulter. *
* *
* Description : Fournit une étiquette pour viser un symbole. *
* *
diff --git a/src/format/symbol.h b/src/format/symbol.h
index e304d69..577eb83 100644
--- a/src/format/symbol.h
+++ b/src/format/symbol.h
@@ -66,9 +66,9 @@ typedef enum _SymbolStatus
typedef enum _SymbolFlag
{
SFL_NONE = (0 << 0), /* Aucune propriété */
- SFL_PREFIXED_NAME = (1 << 0), /* Indication en amont du nom */
+ SFL_HAS_NM_PREFIX = (1 << 0), /* Indication de nature */
- SFL_COUNT
+ SFL_MASK = (1 << 1) - 1, /* Indication de nature */
} SymbolFlag;
@@ -130,6 +130,12 @@ bool g_binary_symbol_has_flag(const GBinSymbol *, SymbolFlag);
/* Fournit les particularités du symbole. */
SymbolFlag g_binary_symbol_get_flags(const GBinSymbol *);
+/* Fournit le préfixe compatible avec une sortie "nm". */
+bool g_binary_symbol_get_nm_prefix(const GBinSymbol *, char *);
+
+/* Définit le préfixe compatible avec une sortie "nm". */
+void g_binary_symbol_set_nm_prefix(const GBinSymbol *, char);
+
/* Fournit une étiquette pour viser un symbole. */
char *g_binary_symbol_get_label(const GBinSymbol *);