summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-29 21:01:51 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-29 21:01:51 (GMT)
commitb8d5a539b1e6837f7395598a3fa25ef69650e885 (patch)
tree2fbf770b1aebf1b66a8ac87e2eeae4521775d092 /src/analysis/disass
parent4f3f96c2c98ac507f4aa7c83e2393c5c1fdd3cdd (diff)
Handled areas which are not allocated in memory.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index bdfb1b2..5478fe3 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -947,6 +947,12 @@ void insert_extra_symbol_into_mem_areas(mem_area *areas, size_t count, const GBi
}
+ /**
+ * Un symbole (au sens large) ne peut avoir une adresse virtuelle que s'il
+ * est compris dans une zone chargée en mémoire (en toute logique).
+ */
+ assert(has_virt_addr(get_mrange_addr(&area->range)) == has_virt_addr(addr));
+
/* L'instruction est-elle accueillie dans son intégralité ? */
start = compute_vmpa_diff(get_mrange_addr(&area->range), addr);
@@ -1238,7 +1244,7 @@ static void g_area_collector_do_compute(GAreaCollector *collector, GtkStatusStac
}
- void fill_gap(vmpa2t *old, vmpa2t *new, bool exec)
+ void fill_gap(vmpa2t *old, vmpa2t *new, bool alloc, bool exec)
{
phys_t diff; /* Espace entre bordures */
mem_area *area; /* Zone avec valeurs à éditer */
@@ -1252,6 +1258,9 @@ static void g_area_collector_do_compute(GAreaCollector *collector, GtkStatusStac
if (diff > 0)
{
+ if (!alloc)
+ reset_virt_addr(old);
+
/* Zone tampon à constituer */
*list = (mem_area *)realloc(*list, ++(*count) * sizeof(mem_area));
@@ -1326,7 +1335,7 @@ static void g_area_collector_do_compute(GAreaCollector *collector, GtkStatusStac
if (on_track)
{
rights = (parent != NULL ? g_binary_portion_get_rights(parent) : PAC_NONE);
- fill_gap(&prev, &border, rights & PAC_EXEC);
+ fill_gap(&prev, &border, rights != PAC_NONE, rights & PAC_EXEC);
}
else
copy_vmpa(&prev, &border);
@@ -1342,12 +1351,12 @@ static void g_area_collector_do_compute(GAreaCollector *collector, GtkStatusStac
if (on_track)
{
rights = (parent != NULL ? g_binary_portion_get_rights(parent) : PAC_NONE);
- fill_gap(&prev, &border, rights & PAC_EXEC);
+ fill_gap(&prev, &border, rights != PAC_NONE, rights & PAC_EXEC);
compute_mrange_end_addr(range, &border);
rights = g_binary_portion_get_rights(portion);
- fill_gap(&prev, &border, rights & PAC_EXEC);
+ fill_gap(&prev, &border, rights != PAC_NONE, rights & PAC_EXEC);
}
else
@@ -1367,7 +1376,7 @@ static void g_area_collector_do_compute(GAreaCollector *collector, GtkStatusStac
if (on_track)
{
rights = (parent != NULL ? g_binary_portion_get_rights(parent) : PAC_NONE);
- fill_gap(&prev, &border, rights & PAC_EXEC);
+ fill_gap(&prev, &border, rights != PAC_NONE, rights & PAC_EXEC);
}
else
copy_vmpa(&prev, &border);