summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/gtkgraphview.c68
1 files changed, 47 insertions, 21 deletions
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index d205e47..57bbec0 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -1208,11 +1208,12 @@ static void gtk_graph_view_reach_caret_limit(GtkBufferView *node, GdkScrollDirec
vmpa2t last; /* Fin d'un groupe de lignes */
const mrange_t *range; /* Couverture courante */
GArchProcessor *proc; /* Processeur pour instructions*/
- GArchInstruction *ref; /* Point de référence */
+ vmpa2t iaddr; /* Adresse du prochain saut */
+ instr_iter_t *iter; /* Boucle de parcours */
+ GArchInstruction *instr; /* Instruction à venir visiter */
#ifndef NDEBUG
bool is_return; /* Est-ce une instruc. finale ?*/
#endif
- vmpa2t iaddr; /* Position de l'instructin */
size_t i; /* Boucle de parcours */
bool updated; /* Besoin d'une mise à jour ? */
@@ -1225,7 +1226,7 @@ static void gtk_graph_view_reach_caret_limit(GtkBufferView *node, GdkScrollDirec
proc = g_loaded_binary_get_processor(GTK_DISPLAY_PANEL(view)->binary);
- ref = NULL;
+ init_vmpa(&iaddr, VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL);
#ifndef NDEBUG
is_return = false;
@@ -1235,42 +1236,66 @@ static void gtk_graph_view_reach_caret_limit(GtkBufferView *node, GdkScrollDirec
{
case GDK_SCROLL_LEFT:
case GDK_SCROLL_UP:
+
if (cmp_vmpa(get_mrange_addr(range), &first) != 0)
{
- ref = g_arch_processor_find_instr_by_address(proc, &first);
+ iter = g_arch_processor_get_iter_from_address(proc, &first);
+
+ if (iter != NULL)
+ {
+ instr = get_instruction_iterator_prev(iter);
+
+ if (instr != NULL)
+ {
+ /* TODO : boucler si !HAS_CODE */
+
+ if (mrange_contains_addr(range, &iaddr))
+ copy_vmpa(&iaddr, get_mrange_addr(g_arch_instruction_get_range(instr)));
- if (ref != NULL)
- ref = g_arch_processor_get_prev_instr(proc, ref);
+ g_object_unref(G_OBJECT(instr));
- /* TODO : boucler si !HAS_CODE */
+ }
- if (ref != NULL)
- copy_vmpa(&iaddr, get_mrange_addr(g_arch_instruction_get_range(ref)));
+ delete_instruction_iterator(iter);
+
+ }
}
+
break;
case GDK_SCROLL_RIGHT:
case GDK_SCROLL_DOWN:
- ref = g_arch_processor_find_instr_by_address(proc, &last);
+ iter = g_arch_processor_get_iter_from_address(proc, &last);
+ if (iter != NULL)
+ {
#ifndef NDEBUG
- if (ref != NULL)
- is_return = (g_arch_instruction_get_flags(ref) & AIF_RETURN_POINT);
+ instr = get_instruction_iterator_current(iter);
+ if (instr != NULL)
+ {
+ is_return = (g_arch_instruction_get_flags(instr) & AIF_RETURN_POINT);
+ g_object_unref(G_OBJECT(instr));
+ }
#endif
- if (ref != NULL)
- ref = g_arch_processor_get_next_instr(proc, ref);
+ instr = get_instruction_iterator_next(iter);
- /* TODO : boucler si !HAS_CODE */
+ if (instr != NULL)
+ {
+ /* TODO : boucler si !HAS_CODE */
- if (ref != NULL)
- {
- copy_vmpa(&iaddr, get_mrange_addr(g_arch_instruction_get_range(ref)));
+ copy_vmpa(&iaddr, get_mrange_addr(g_arch_instruction_get_range(instr)));
+
+ if (!mrange_contains_addr(range, &iaddr))
+ init_vmpa(&iaddr, VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL);
+
+ g_object_unref(G_OBJECT(instr));
+
+ }
- if (!mrange_contains_addr(range, &iaddr))
- ref = NULL;
+ delete_instruction_iterator(iter);
}
@@ -1286,7 +1311,8 @@ static void gtk_graph_view_reach_caret_limit(GtkBufferView *node, GdkScrollDirec
/* Recherche du bloc parent */
- if (ref == NULL)
+ /* FIXME : valid ! */
+ if (iaddr.physical == VMPA_NO_PHYSICAL && iaddr.virtual == VMPA_NO_VIRTUAL)
return;
for (i = 0; i < view->children_count; i++)