From 25aaa3ac8bd429e93cd1b04f905151b4be25c207 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 14 May 2017 21:38:19 +0200 Subject: Displayed a symbol instead of a routine in the graph view. --- ChangeLog | 5 +++ src/gtkext/gtkgraphdisplay.c | 100 ++++++++++++++----------------------------- 2 files changed, 37 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index 640055d..4b12204 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 17-05-14 Cyrille Bagard + * src/gtkext/gtkgraphdisplay.c: + Display a symbol instead of a routine in the graph view. + +17-05-14 Cyrille Bagard + * plugins/pychrysa/format/symbol.c: Delete access to the removed features. diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c index 4b10bf0..8139b3a 100644 --- a/src/gtkext/gtkgraphdisplay.c +++ b/src/gtkext/gtkgraphdisplay.c @@ -43,7 +43,7 @@ struct _GtkGraphDisplay GtkWidget *support; /* Support des vues en bloc */ GtkWidget *extender; /* Force la taille du support */ - GBinRoutine *routine; /* Routine en cours d'affichage*/ + GBinSymbol *routine; /* Routine en cours d'affichage*/ segcnt_list *highlighted; /* Segments mis en évidence */ @@ -613,9 +613,9 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons bool need_update; /* Mise à jour du contenu ? */ const mrange_t *range; /* Couverture courante */ GExeFormat *format; /* Type de fichier chargé */ - GBinRoutine **routines; /* Liste des routines trouvées */ - size_t routines_count; /* Nombre de ces routines */ - size_t i; /* Boucle de parcours */ + GBinSymbol *symbol; /* Symbole présent à l'adresse */ + bool found; /* Bilan des recherches */ + GBlockList *list; /* Liste de blocs basiques */ gint right; /* Abscisse du coin droit */ gint bottom; /* Ordonnée du coin inférieur */ GtkAllocation allocation; /* Espace alloué au panneau */ @@ -624,7 +624,7 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons need_update = true; else { - range = g_binary_routine_get_range(display->routine); + range = g_binary_symbol_get_range(display->routine); need_update = !mrange_contains_addr(range, addr); } @@ -633,83 +633,47 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons gtk_graph_display_reset(display); format = g_loaded_binary_get_format(GTK_DISPLAY_PANEL(display)->binary); - routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count); - - for (i = 0; i < routines_count; i++) - { - range = g_binary_routine_get_range(routines[i]); - - if (mrange_contains_addr(range, addr)) - { - display->routine = routines[i]; - g_object_ref(G_OBJECT(display->routine)); - - display->highlighted = init_segment_content_list(); - /* - display->children = gtk_graph_display_load_nodes(display, GTK_DISPLAY_PANEL(display)->binary, - routines[i]); + found = g_binary_format_find_symbol_for(G_BIN_FORMAT(format), addr, &symbol); - display->allocs = (GtkAllocation *)calloc(display->children_count, - sizeof(GtkAllocation)); + if (!found) + goto ggddma_done; - display->layout = g_graph_layout_new(g_binary_routine_get_basic_blocks(display->routine), - display->children, display->children_count); + if (g_binary_symbol_get_routine(symbol) == NULL) + goto ggddma_done; - g_graph_layout_place(display->layout, display); - */ - - do - { - - GBlockList *list; - - list = g_binary_routine_get_basic_blocks(routines[i]); - -#if 0 - display->cluster = g_graph_cluster_new(GTK_DISPLAY_PANEL(display)->binary, - list, 0/* FIXME */, display->highlighted); -#endif + display->routine = symbol; + g_object_ref(G_OBJECT(symbol)); + display->highlighted = init_segment_content_list(); - display->cluster = bootstrap_graph_cluster(GTK_DISPLAY_PANEL(display)->binary, - list, display->highlighted); + list = g_binary_routine_get_basic_blocks(g_binary_symbol_get_routine(symbol)); + display->cluster = bootstrap_graph_cluster(GTK_DISPLAY_PANEL(display)->binary, + list, display->highlighted); + g_graph_cluster_place(display->cluster, display); - g_graph_cluster_place(display->cluster, display); + /** + * Comme la taille du support ne peut pas être forcée et + * étendue pour comprendre les ombres, on place un composant + * minuscule à l'extrémité de ce support. + */ - /** - * Comme la taille du support ne peut pas être forcée et - * étendue pour comprendre les ombres, on place un composant - * minuscule à l'extrémité de ce support. - */ + gtk_graph_display_compute_requested_size(display, &right, &bottom); - gtk_graph_display_compute_requested_size(display, &right, &bottom); + g_object_ref(G_OBJECT(display->extender)); + gtk_fixed_put(GTK_FIXED(display->support), display->extender, right - 1, bottom - 1); - g_object_ref(G_OBJECT(display->extender)); - gtk_fixed_put(GTK_FIXED(display->support), display->extender, right - 1, bottom - 1); + /** + * Si possible, on centre le contenu obtenu. + */ - /** - * Si possible, on centre le contenu obtenu. - */ + gtk_widget_get_allocation(GTK_WIDGET(display), &allocation); - gtk_widget_get_allocation(GTK_WIDGET(display), &allocation); + gtk_graph_display_update_support_margins(display, &allocation); - gtk_graph_display_update_support_margins(display, &allocation); - - - - } - while (0); - - - - break; - - } - - } + ggddma_done: change_editor_items_current_view_content(GTK_DISPLAY_PANEL(display)); @@ -1063,7 +1027,7 @@ static void gtk_graph_display_reach_caret_limit(GtkBufferDisplay *node, GdkScrol g_buffer_view_get_restrictions(view, &first, &last); g_object_unref(G_OBJECT(view)); - range = g_binary_routine_get_range(display->routine); + range = g_binary_symbol_get_range(display->routine); proc = g_loaded_binary_get_processor(GTK_DISPLAY_PANEL(display)->binary); -- cgit v0.11.2-87-g4458