summaryrefslogtreecommitdiff
path: root/src/format/dwarf/dwarf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/dwarf/dwarf.c')
-rw-r--r--src/format/dwarf/dwarf.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/format/dwarf/dwarf.c b/src/format/dwarf/dwarf.c
index db8335b..519aa49 100644
--- a/src/format/dwarf/dwarf.c
+++ b/src/format/dwarf/dwarf.c
@@ -47,18 +47,20 @@ static void g_dwarf_format_finalize(GDwarfFormat *);
* *
* Paramètres : content = contenu binaire à parcourir. *
* parent = éventuel format exécutable déjà chargé. *
+* unused = adresse non utilisée ici. *
+* key = identifiant de format trouvé ou NULL. [OUT] *
* *
* Description : Indique si le format peut être pris en charge ici. *
* *
-* Retour : Désignation du format reconnu ou NULL si aucun. *
+* Retour : Conclusion de haut niveau sur la reconnaissance effectuée. *
* *
* Remarques : - *
* *
******************************************************************************/
-const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent)
+FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, void *unused, char **key)
{
- const char *result; /* Format détecté à renvoyer */
+ FormatMatchStatus result; /* Bilan à renvoyer */
size_t i; /* Boucle de parcours */
mrange_t range; /* Couverture d'une section */
dw_section_header header; /* En-tête DWARF de section */
@@ -114,10 +116,10 @@ const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent)
0 /* .debug_types */
};
- result = NULL;
+ result = FMS_UNKNOWN;
if (parent == NULL)
- return NULL;
+ return FMS_UNKNOWN;
/* Lecture des indices présents */
@@ -159,23 +161,32 @@ const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent)
found = check_dwarf_version(dwarf_v4_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
- result = "dwarf_v4";
+ {
+ result = FMS_MATCHED;
+ *key = strdup("dwarf_v4");
+ }
- if (result == NULL)
+ if (result == FMS_UNKNOWN)
{
found = check_dwarf_version(dwarf_v3_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
- result = "dwarf_v3";
+ {
+ result = FMS_MATCHED;
+ *key = strdup("dwarf_v3");
+ }
}
- if (result == NULL)
+ if (result == FMS_UNKNOWN)
{
found = check_dwarf_version(dwarf_v2_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
- result = "dwarf_v2";
+ {
+ result = FMS_MATCHED;
+ *key = strdup("dwarf_v2");
+ }
}