summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-09-01 22:20:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-09-01 22:20:28 (GMT)
commit04ca0756d59629113bd3f602565850a2910ac84e (patch)
tree26c70bc546e4ac55967530beb583dc851b2f82c9 /src/analysis
parenta738b482b70d263252ec4dc18919c71503490297 (diff)
Loaded some ELF symbols from DYNSYM and SYMTAB sections.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@397 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/fetch.c27
-rw-r--r--src/analysis/disass/output.c2
-rw-r--r--src/analysis/routine.c30
-rw-r--r--src/analysis/routine.h4
4 files changed, 31 insertions, 32 deletions
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c
index 20128aa..55ea1d4 100644
--- a/src/analysis/disass/fetch.c
+++ b/src/analysis/disass/fetch.c
@@ -135,22 +135,26 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
+ vmpa2t *last; /* Dernière bordure rencontrée */
+
+
+
GBinSymbol **symbols; /* Symboles à représenter */
size_t sym_count; /* Qté de symboles présents */
size_t i; /* Boucle de parcours */
- GArchInstruction *instr; /* Instruction à insérer */
-
-
- vmpa2t *last; /* Dernière bordure rencontrée */
const vmpa2t *border; /* Nouvelle bordure rencontrée */
off_t length; /* Taille d'une partie traitée */
+ GArchInstruction *instr; /* Instruction à insérer */
+
+
+
GArchInstruction *joint; /* Jointure entre deux lots */
@@ -179,19 +183,26 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt
+ border = g_binary_symbol_get_location(symbols[i], &length);
switch (g_binary_symbol_get_target_type(symbols[i]))
{
case STP_DATA:
instr = g_binary_symbol_get_instruction(symbols[i]);
g_object_ref(G_OBJECT(instr));
- border = g_arch_instruction_get_location2(instr, &length);
-
- // Utiliser : ???
- // const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol)
+ break;
+ case STP_ROUTINE:
+ instr = load_raw_binary(binary, border,
+ get_phy_addr(border) + length,
+ statusbar, id);
break;
+ default:
+ printf("BADDD !\n");
+ exit(0);
+ break;
+
}
/* Traiter la diff */
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index 927088f..f368796 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -130,7 +130,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form
if (sym_index < sym_count)
{
iaddr = g_arch_instruction_get_location2(iter, NULL);
- saddr = g_binary_symbol_get_address2(symbols[sym_index]);
+ saddr = g_binary_symbol_get_location(symbols[sym_index], NULL);
if (cmp_vmpa_by_phy(iaddr, saddr) == 0)
{
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index d97dfc7..eebcb69 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -38,7 +38,7 @@ struct _GBinRoutine
{
GObject parent; /* A laisser en premier */
- vmpa_t addr; /* Position physique/mémoire */
+ vmpa2t addr; /* Position physique/mémoire */
off_t size; /* Taille du code associé */
RoutineType type; /* Type de routine */
@@ -214,13 +214,7 @@ void g_binary_routine_finalize(GBinRoutine *routine)
int g_binary_routine_compare(const GBinRoutine **a, const GBinRoutine **b)
{
- int result; /* Bilan à renvoyer */
-
- if ((*a)->addr < (*b)->addr) result = -1;
- else if((*a)->addr > (*b)->addr) result = 1;
- else result = 0;
-
- return result;
+ return cmp_vmpa(&(*a)->addr, &(*b)->addr);
}
@@ -232,7 +226,7 @@ int g_binary_routine_compare(const GBinRoutine **a, const GBinRoutine **b)
* *
* Description : Etablit la comparaison descendante entre deux routines. *
* *
-* Retour : Bilan : -1 (a < b), 0 (a == b) ou 1 (a > b). *
+* Retour : Bilan : 1 (a < b), 0 (a == b) ou -1 (a > b). *
* *
* Remarques : - *
* *
@@ -240,13 +234,7 @@ int g_binary_routine_compare(const GBinRoutine **a, const GBinRoutine **b)
int g_binary_routine_rcompare(const GBinRoutine **a, const GBinRoutine **b)
{
- int result; /* Bilan à renvoyer */
-
- if ((*a)->addr > (*b)->addr) result = -1;
- else if((*a)->addr < (*b)->addr) result = 1;
- else result = 0;
-
- return result;
+ return (-1) * cmp_vmpa(&(*a)->addr, &(*b)->addr);
}
@@ -264,9 +252,9 @@ int g_binary_routine_rcompare(const GBinRoutine **a, const GBinRoutine **b)
* *
******************************************************************************/
-void g_binary_routine_set_address(GBinRoutine *routine, vmpa_t addr)
+void g_binary_routine_set_address(GBinRoutine *routine, const vmpa2t *addr)
{
- routine->addr = addr;
+ copy_vmpa(&routine->addr, addr);
}
@@ -283,9 +271,9 @@ void g_binary_routine_set_address(GBinRoutine *routine, vmpa_t addr)
* *
******************************************************************************/
-vmpa_t g_binary_routine_get_address(const GBinRoutine *routine)
+const vmpa2t *g_binary_routine_get_address(const GBinRoutine *routine)
{
- return routine->addr;
+ return &routine->addr;
}
@@ -293,7 +281,7 @@ vmpa_t g_binary_routine_get_address(const GBinRoutine *routine)
/******************************************************************************
* *
* Paramètres : routine = routine à mettre à jour. *
-* addr = taille du code associé. *
+* size = taille du code associé. *
* *
* Description : Définit la taille du code d'une routine. *
* *
diff --git a/src/analysis/routine.h b/src/analysis/routine.h
index de1b6ba..29f6e63 100644
--- a/src/analysis/routine.h
+++ b/src/analysis/routine.h
@@ -87,10 +87,10 @@ int g_binary_routine_compare(const GBinRoutine **, const GBinRoutine **);
int g_binary_routine_rcompare(const GBinRoutine **, const GBinRoutine **);
/* Définit la position physique / en mémoire d'une routine. */
-void g_binary_routine_set_address(GBinRoutine *, vmpa_t);
+void g_binary_routine_set_address(GBinRoutine *, const vmpa2t *);
/* Fournit la position physique / en mémoire d'une routine. */
-vmpa_t g_binary_routine_get_address(const GBinRoutine *);
+const vmpa2t *g_binary_routine_get_address(const GBinRoutine *);
/* Définit la taille du code d'une routine. */
void g_binary_routine_set_size(GBinRoutine *, off_t);