summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c14
-rw-r--r--src/analysis/line_code.c19
-rw-r--r--src/analysis/line_comment.c19
-rw-r--r--src/analysis/prototype.c19
-rw-r--r--src/analysis/prototype.h3
5 files changed, 61 insertions, 13 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 88201ac..01ccfdd 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -39,6 +39,7 @@
#include "line_comment.h"
#include "line_prologue.h"
#include "prototype.h"
+#include "../panel/log.h"
#include "../plugins/pglist.h"
@@ -117,23 +118,22 @@ openida_binary *load_binary_file(const char *filename)
switch (get_exe_target_machine(result->format))
{
case FTM_JVM:
- result->proc = get_arch_processor_for_type(APT_JVM);
+ log_simple_message(LMT_INFO, _("Detected architecture: Java Virtual Machine"));
break;
-
case FTM_MIPS:
- result->proc = get_arch_processor_for_type(APT_MIPS);
+ log_simple_message(LMT_INFO, _("Detected architecture: Microprocessor without Interlocked Pipeline Stages"));
break;
-
case FTM_386:
- result->proc = get_arch_processor_for_type(APT_386);
+ log_simple_message(LMT_INFO, _("Detected architecture: i386"));
break;
-
default:
+ log_simple_message(LMT_INFO, _("Unknown architecture"));
goto lbf_error;
break;
-
}
+ result->proc = get_arch_processor_from_format(result->format);
+
result->options.show_address = true;
result->options.show_code = true;
diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c
index a234055..cd7eba6 100644
--- a/src/analysis/line_code.c
+++ b/src/analysis/line_code.c
@@ -174,15 +174,28 @@ void g_code_line_refresh_markup(GCodeLine *line)
if (line->options->show_address)
{
- switch (ADM_32BITS /* FIXME */)
+ switch (g_arch_processor_get_memory_size(line->options->proc))
{
- case ADM_32BITS:
+ case MDS_8_BITS:
+ snprintf(buffer, CODE_BUFFER_LEN,
+ "<span foreground='#333333'>0x%02llx</span>",
+ G_RENDERING_LINE(line)->offset);
+ break;
+
+ case MDS_16_BITS:
+ snprintf(buffer, CODE_BUFFER_LEN,
+ "<span foreground='#333333'>0x%04llx</span>",
+ G_RENDERING_LINE(line)->offset);
+ break;
+
+ case MDS_32_BITS:
snprintf(buffer, CODE_BUFFER_LEN,
"<span foreground='#333333'>0x%08llx</span>",
G_RENDERING_LINE(line)->offset);
break;
- case ADM_64BITS:
+ default:
+ case MDS_64_BITS:
snprintf(buffer, CODE_BUFFER_LEN,
"<span foreground='#333333'>0x%16llx</span>",
G_RENDERING_LINE(line)->offset);
diff --git a/src/analysis/line_comment.c b/src/analysis/line_comment.c
index ea6d6d6..1d37613 100644
--- a/src/analysis/line_comment.c
+++ b/src/analysis/line_comment.c
@@ -137,15 +137,28 @@ void g_comment_line_refresh_markup(GCommentLine *line)
if (line->options->show_address)
{
- switch (ADM_32BITS /* FIXME */)
+ switch (g_arch_processor_get_memory_size(line->options->proc))
{
- case ADM_32BITS:
+ case MDS_8_BITS:
+ snprintf(buffer, CODE_BUFFER_LEN,
+ "<span foreground='#333333'>0x%02llx</span>",
+ G_RENDERING_LINE(line)->offset);
+ break;
+
+ case MDS_16_BITS:
+ snprintf(buffer, CODE_BUFFER_LEN,
+ "<span foreground='#333333'>0x%04llx</span>",
+ G_RENDERING_LINE(line)->offset);
+ break;
+
+ case MDS_32_BITS:
snprintf(buffer, CODE_BUFFER_LEN,
"<span foreground='#333333'>0x%08llx</span>",
G_RENDERING_LINE(line)->offset);
break;
- case ADM_64BITS:
+ default:
+ case MDS_64_BITS:
snprintf(buffer, CODE_BUFFER_LEN,
"<span foreground='#333333'>0x%16llx</span>",
G_RENDERING_LINE(line)->offset);
diff --git a/src/analysis/prototype.c b/src/analysis/prototype.c
index 1e27f2c..78854f9 100644
--- a/src/analysis/prototype.c
+++ b/src/analysis/prototype.c
@@ -245,6 +245,25 @@ void g_binary_routine_set_name(GBinRoutine *routine, char *name)
/******************************************************************************
* *
* Paramètres : routine = routine à mettre à jour. *
+* *
+* Description : Fournit le nom humain d'une routine. *
+* *
+* Retour : Désignation humainement lisible ou NULL si non définie. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *g_binary_routine_get_name(const GBinRoutine *routine)
+{
+ return routine->name;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : routine = routine à mettre à jour. *
* var = variable représentant un type de retour. *
* *
* Description : Définit le type de retour d'une routine. *
diff --git a/src/analysis/prototype.h b/src/analysis/prototype.h
index 3fd822e..299cce6 100644
--- a/src/analysis/prototype.h
+++ b/src/analysis/prototype.h
@@ -75,6 +75,9 @@ void g_binary_routine_set_type(GBinRoutine *, RoutineType);
/* Définit le nom humain d'une routine. */
void g_binary_routine_set_name(GBinRoutine *, char *);
+/* Désignation humainement lisible ou NULL si non définie. */
+const char *g_binary_routine_get_name(const GBinRoutine *);
+
/* Définit le type de retour d'une routine. */
void g_binary_routine_set_return_type(GBinRoutine *, variable *);