summaryrefslogtreecommitdiff
path: root/src/format/elf
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/elf')
-rw-r--r--src/format/elf/e_elf.c36
-rw-r--r--src/format/elf/e_elf.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/src/format/elf/e_elf.c b/src/format/elf/e_elf.c
index a69be68..91e0403 100644
--- a/src/format/elf/e_elf.c
+++ b/src/format/elf/e_elf.c
@@ -106,6 +106,7 @@ elf_format *load_elf(const uint8_t *content, off_t length)
EXE_FORMAT(result)->get_symbols = (get_symbols_fc)get_elf_symbols;
EXE_FORMAT(result)->get_resolved = (get_resolved_fc)get_elf_resolved_items;
EXE_FORMAT(result)->resolve_symbol = (resolve_symbol_fc)resolve_elf_symbol;
+ EXE_FORMAT(result)->get_all_routines = (get_all_routines_fc)get_all_elf_routines;
memcpy(&result->header, content, sizeof(Elf32_Ehdr));
@@ -394,3 +395,38 @@ bool resolve_elf_symbol(const elf_format *format, char **label, SymbolType *type
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* count = taille du tableau créé. [OUT] *
+* *
+* Description : Fournit le prototype de toutes les routines détectées. *
+* *
+* Retour : Tableau créé ou NULL si aucun symbole de routine trouvé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bin_routine **get_all_elf_routines(const elf_format *format, size_t *count)
+{
+ bin_routine **result; /* Tableau à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = (bin_routine **)calloc(format->sym_count, sizeof(bin_routine *));
+ *count = format->sym_count;
+
+ for (i = 0; i < format->sym_count; i++)
+ {
+ result[i] = create_binary_routine();
+
+ set_binary_routine_offset(result[i], format->symbols[i].address);
+ set_binary_routine_name(result[i], strdup(format->symbols[i].name));
+
+ }
+
+ return result;
+
+}
diff --git a/src/format/elf/e_elf.h b/src/format/elf/e_elf.h
index fffeff2..f0c2c12 100644
--- a/src/format/elf/e_elf.h
+++ b/src/format/elf/e_elf.h
@@ -55,6 +55,8 @@ size_t get_elf_symbols(const elf_format *, char ***, SymbolType **, uint64_t **)
/* Recherche le symbole correspondant à une adresse. */
bool resolve_elf_symbol(const elf_format *, char **, SymbolType *, uint64_t *);
+/* Fournit le prototype de toutes les routines détectées. */
+bin_routine **get_all_elf_routines(const elf_format *, size_t *);