diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-03-26 14:02:38 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-03-26 14:02:38 (GMT) |
commit | 4f3f96c2c98ac507f4aa7c83e2393c5c1fdd3cdd (patch) | |
tree | fd275566fdb4171e850df2128ac829932bcc69fa /src/analysis | |
parent | 78169fc7f8a7150cd22cfe80204cb2faaa991ba5 (diff) |
Limited the displayed calls and strings in tooltips using the configuration.
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/routine.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c index 9ec17c1..f84a5fd 100644 --- a/src/analysis/routine.c +++ b/src/analysis/routine.c @@ -35,6 +35,7 @@ #include "../arch/raw.h" #include "../common/extstr.h" +#include "../core/params.h" @@ -1156,6 +1157,9 @@ void g_binary_routine_print_code(const GBinRoutine *routine, GLangOutput *lang, char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBinary *binary) { char *result; /* Description à retourner */ + GGenConfig *config; /* Configuration à consulter */ + unsigned int max_calls; /* Quantité d'appels à afficher*/ + unsigned int max_strings; /* Nbre de chaînes à afficher */ unsigned int ins_count; /* Quantité d'instructions */ unsigned int call_count; /* Quantité d'appels */ char *call_info; /* Détails des appels */ @@ -1176,6 +1180,19 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi result = NULL; + + config = get_main_configuration(); + + if (!g_generic_config_get_value(config, MPK_TOOLTIP_MAX_CALLS, &max_calls)) + goto gbrbt_bad_config; + + max_calls++; + + if (!g_generic_config_get_value(config, MPK_TOOLTIP_MAX_STRINGS, &max_strings)) + goto gbrbt_bad_config; + + max_strings++; + ins_count = 0; call_count = 0; @@ -1212,10 +1229,10 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi call_count++; - if (call_count > 6) + if (call_count > max_calls) continue; - if (call_count == 6) + if (call_count == max_calls) { call_info = stradd(call_info, "\n ..."); continue; @@ -1263,10 +1280,10 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi string_count++; - if (string_count > 6) + if (string_count > max_strings) continue; - if (string_count == 6) + if (string_count == max_strings) { string_info = stradd(string_info, "\n ..."); continue; @@ -1379,6 +1396,8 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi g_object_unref(G_OBJECT(cache)); g_object_unref(G_OBJECT(proc)); + gbrbt_bad_config: + return result; } |