summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-12-08 20:50:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-12-08 20:50:56 (GMT)
commit39116dce7d40dab310e929f92fdbfc865b5fac20 (patch)
treea0b8dc11070f8a68de6b6f7bbc84b3d4ccf25afd /src/format
parentcf11fcf862b98ef57935bcfccd6f2f6ae3f925f6 (diff)
Introduced the symbol visibility.
Diffstat (limited to 'src/format')
-rw-r--r--src/format/format.c2
-rw-r--r--src/format/symbol-int.h1
-rw-r--r--src/format/symbol.c41
-rw-r--r--src/format/symbol.h18
4 files changed, 61 insertions, 1 deletions
diff --git a/src/format/format.c b/src/format/format.c
index 8b1bf0a..ec8e5fb 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -407,7 +407,7 @@ bool g_binary_format_add_symbol(GBinFormat *format, GBinSymbol *symbol)
range = g_binary_symbol_get_range(symbol);
addr = get_mrange_addr(range);
- assert(has_phys_addr(addr));
+ assert(has_phys_addr(addr) || g_binary_symbol_get_status(symbol) == SSS_IMPORTED);
#endif
g_rw_lock_writer_lock(&format->syms_lock);
diff --git a/src/format/symbol-int.h b/src/format/symbol-int.h
index 49a0b97..a0460c2 100644
--- a/src/format/symbol-int.h
+++ b/src/format/symbol-int.h
@@ -41,6 +41,7 @@ struct _GBinSymbol
mrange_t range; /* Couverture mémoire */
SymbolType type; /* Type du symbole */
+ SymbolStatus status; /* Visibilité du symbole */
char *alt; /* Nom alternatif */
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 0b300bd..099b764 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -123,6 +123,8 @@ static void g_binary_symbol_init(GBinSymbol *symbol)
{
g_binary_symbol_set_target_type(symbol, STP_COUNT);
+ g_binary_symbol_set_status(symbol, SSS_INTERNAL);
+
}
@@ -345,6 +347,45 @@ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *symbol)
/******************************************************************************
* *
+* Paramètres : symbol = symbole à venir modifier. *
+* status = état de la visibilité du symbole représenté. *
+* *
+* Description : Définit la visibilité du symbole. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_binary_symbol_set_status(GBinSymbol *symbol, SymbolStatus status)
+{
+ symbol->status = status;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : symbol = symbole à venir consulter. *
+* *
+* Description : Fournit la visibilité du symbole. *
+* *
+* Retour : Etat de la visibilité du symbole représenté. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+SymbolStatus g_binary_symbol_get_status(const GBinSymbol *symbol)
+{
+ return symbol->status;
+
+}
+
+
+/******************************************************************************
+* *
* 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 da51262..8aabfdf 100644
--- a/src/format/symbol.h
+++ b/src/format/symbol.h
@@ -51,6 +51,18 @@ typedef enum _SymbolType
} SymbolType;
+/* Visibilité du symbole */
+typedef enum _SymbolStatus
+{
+ SSS_INTERNAL, /* Visibilité nulle */
+ SSS_EXPORTED, /* Disponibilité extérieure */
+ SSS_IMPORTED, /* Besoin interne */
+
+ SSS_COUNT
+
+} SymbolStatus;
+
+
#define G_TYPE_BIN_SYMBOL g_binary_symbol_get_type()
#define G_BIN_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_binary_symbol_get_type(), GBinSymbol))
#define G_IS_BIN_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_binary_symbol_get_type()))
@@ -90,6 +102,12 @@ void g_binary_symbol_set_target_type(GBinSymbol *, SymbolType);
/* Fournit le type du symbole. */
SymbolType g_binary_symbol_get_target_type(const GBinSymbol *);
+/* Définit la visibilité du symbole. */
+void g_binary_symbol_set_status(GBinSymbol *, SymbolStatus);
+
+/* Fournit la visibilité du symbole. */
+SymbolStatus g_binary_symbol_get_status(const GBinSymbol *);
+
/* Fournit une étiquette pour viser un symbole. */
const char *g_binary_symbol_get_label(GBinSymbol *);