summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-23 16:22:50 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-23 18:53:25 (GMT)
commit56f7524c4fd0fc14a509be7689f4820b31564dbc (patch)
tree9c84e11279cd5711a4e0af907ca6160b62317528 /src/analysis
parent3f05bacd4fec23824489b51d964a7ce3565bb85b (diff)
Deleted a level of data to reduce the memory fingerprint.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/db/items/switcher.c26
-rw-r--r--src/analysis/disass/output.c14
-rw-r--r--src/analysis/routine.c14
-rw-r--r--src/analysis/types/basic.c2
-rw-r--r--src/analysis/types/cse.c4
-rw-r--r--src/analysis/types/encaps.c2
-rw-r--r--src/analysis/types/literal.c2
-rw-r--r--src/analysis/types/template.c6
-rw-r--r--src/analysis/variable.c4
9 files changed, 31 insertions, 43 deletions
diff --git a/src/analysis/db/items/switcher.c b/src/analysis/db/items/switcher.c
index a67040f..08a5a5f 100644
--- a/src/analysis/db/items/switcher.c
+++ b/src/analysis/db/items/switcher.c
@@ -502,7 +502,6 @@ static bool g_db_switcher_run(GDbSwitcher *switcher, GLoadedBinary *binary, ImmO
GArchOperand *op; /* Opérande à modifier */
GCodeBuffer *buffer; /* Tampon de lignes à traiter */
GBufferLine *line; /* Ligne de tampon à marquer */
- GBufferSegment *segment; /* Segment de texte à modifier*/
GImmOperand *operand; /* Opérande de valeur immédiate*/
char value[IMM_MAX_SIZE]; /* Chaîne à imprimer */
size_t len; /* Taille de l'élément inséré */
@@ -541,29 +540,18 @@ static bool g_db_switcher_run(GDbSwitcher *switcher, GLoadedBinary *binary, ImmO
goto exit_gui;
}
- segment = g_buffer_line_find_segment_from_creator(line, G_OBJECT(op));
- result = (segment != NULL);
+ operand = G_IMM_OPERAND(op);
- /* Applications globales finales */
+ *old = g_imm_operand_get_display(operand);
- if (result)
- {
- operand = G_IMM_OPERAND(op);
-
- *old = g_imm_operand_get_display(operand);
-
- if (new == IOD_COUNT)
- new = g_imm_operand_get_default_display(operand);
+ if (new == IOD_COUNT)
+ new = g_imm_operand_get_default_display(operand);
- g_imm_operand_set_display(operand, new);
+ g_imm_operand_set_display(operand, new);
- len = g_imm_operand_to_string(operand, ASX_INTEL, value);
+ len = g_imm_operand_to_string(operand, ASX_INTEL, value);
- g_buffer_segment_update_text(segment, value, len);
-
- g_object_unref(G_OBJECT(segment));
-
- }
+ result = g_buffer_line_replace_text(line, G_OBJECT(op), value, len);
g_object_unref(G_OBJECT(line));
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index fb3f5ed..4fdc3c0 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -147,8 +147,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA
g_buffer_line_fill_mrange(line, msize, msize);
g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD,
- ROUTINE_OUTRO_MSG, strlen(ROUTINE_OUTRO_MSG), RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD,
+ ROUTINE_OUTRO_MSG, strlen(ROUTINE_OUTRO_MSG), RTT_COMMENT, NULL);
g_code_buffer_append_new_line(buffer, line);
@@ -223,8 +223,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA
g_buffer_line_fill_mrange(line, msize, msize);
g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD,
- ROUTINE_INTRO_MSG, strlen(ROUTINE_INTRO_MSG), RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD,
+ ROUTINE_INTRO_MSG, strlen(ROUTINE_INTRO_MSG), RTT_COMMENT, NULL);
g_code_buffer_append_new_line(buffer, line);
@@ -255,8 +255,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA
g_buffer_line_fill_mrange(line, msize, msize);
g_buffer_line_start_merge_at(line, BLC_ASSEMBLY_HEAD);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, label, strlen(label), RTT_LABEL);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, ":", 1, RTT_PUNCT);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, label, strlen(label), RTT_LABEL, NULL);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, ":", 1, RTT_PUNCT, NULL);
g_code_buffer_append_new_line(buffer, line);
@@ -311,7 +311,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, GExeFormat *format, GA
- g_buffer_line_insert_text(line, BLC_COMMENTS, prefixed, strlen(prefixed), RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_COMMENTS, prefixed, strlen(prefixed), RTT_COMMENT, NULL);
free(prefixed);
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 7483bf0..ed91726 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -1033,7 +1033,7 @@ void g_binary_routine_output_info(const GBinRoutine *routine, GLangOutput *lang,
g_data_type_output(routine->ret_type, lang, line, true, false);
- g_buffer_line_insert_text(line, BLC_LAST_USED, " ", 1, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, " ", 1, RTT_COMMENT, NULL);
/* Nom de la routine */
@@ -1045,22 +1045,22 @@ void g_binary_routine_output_info(const GBinRoutine *routine, GLangOutput *lang,
len = 3;
}
- g_buffer_line_insert_text(line, BLC_LAST_USED, name, len, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, name, len, RTT_COMMENT, NULL);
/* Arguments éventuels... */
- g_buffer_line_insert_text(line, BLC_LAST_USED, "(", 1, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, "(", 1, RTT_COMMENT, NULL);
for (i = 0; i < routine->args_count; i++)
{
if (i > 0)
- g_buffer_line_insert_text(line, BLC_LAST_USED, ", ", 2, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, ", ", 2, RTT_COMMENT, NULL);
g_binary_variable_output(routine->args[i], lang, line, true, false);
}
- g_buffer_line_insert_text(line, BLC_LAST_USED, ")", 1, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, ")", 1, RTT_COMMENT, NULL);
//g_lang_output_end_routine_prototype(lang, buffer, line);
@@ -1092,7 +1092,7 @@ void g_binary_routine_print_code(const GBinRoutine *routine, GLangOutput *lang,
line = g_lang_output_start_routine_prototype(lang, buffer, routine->ret_type);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW, NULL);
/* Nom de la routine */
@@ -1104,7 +1104,7 @@ void g_binary_routine_print_code(const GBinRoutine *routine, GLangOutput *lang,
len = 3;
}
- g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, name, len, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, name, len, RTT_COMMENT, NULL);
diff --git a/src/analysis/types/basic.c b/src/analysis/types/basic.c
index 0bf3ad4..dcd8634 100644
--- a/src/analysis/types/basic.c
+++ b/src/analysis/types/basic.c
@@ -319,7 +319,7 @@ static void g_basic_type_output(const GBasicType *type, GLangOutput *lang, GBuff
text = g_basic_type_to_string(type);
len = strlen(text);
- g_buffer_line_insert_text(line, BLC_LAST_USED, text, len, info ? RTT_COMMENT : RTT_RAW);
+ g_buffer_line_append_text(line, BLC_LAST_USED, text, len, info ? RTT_COMMENT : RTT_RAW, NULL);
free(text);
diff --git a/src/analysis/types/cse.c b/src/analysis/types/cse.c
index 4a0e4e5..2411cd1 100644
--- a/src/analysis/types/cse.c
+++ b/src/analysis/types/cse.c
@@ -172,7 +172,7 @@ char *g_class_enum_type_to_string(const GClassEnumType *type)
void g_class_enum_type_output(const GClassEnumType *type, GLangOutput *lang, GBufferLine *line, bool info, bool full)
{
- g_buffer_line_insert_text(line, BLC_LAST_USED, type->name, strlen(type->name),
- info ? RTT_COMMENT : RTT_RAW);
+ g_buffer_line_append_text(line, BLC_LAST_USED, type->name, strlen(type->name),
+ info ? RTT_COMMENT : RTT_RAW, NULL);
}
diff --git a/src/analysis/types/encaps.c b/src/analysis/types/encaps.c
index dffc69d..7ca8885 100644
--- a/src/analysis/types/encaps.c
+++ b/src/analysis/types/encaps.c
@@ -276,7 +276,7 @@ static char *g_encapsulated_type_to_string(const GEncapsulatedType *type)
static void g_encapsulated_type_output(const GEncapsulatedType *type, GLangOutput *lang, GBufferLine *line, bool info, bool full)
{
- g_buffer_line_insert_text(line, BLC_LAST_USED, "!TODO!", 6, info ? RTT_COMMENT : RTT_RAW);
+ g_buffer_line_append_text(line, BLC_LAST_USED, "!TODO!", 6, info ? RTT_COMMENT : RTT_RAW, NULL);
}
diff --git a/src/analysis/types/literal.c b/src/analysis/types/literal.c
index 7dbd5f0..5c3a3e8 100644
--- a/src/analysis/types/literal.c
+++ b/src/analysis/types/literal.c
@@ -234,7 +234,7 @@ static void g_literal_type_output(const GLiteralType *type, GLangOutput *lang, G
text = g_literal_type_to_string(type);
len = strlen(text);
- g_buffer_line_insert_text(line, BLC_LAST_USED, text, len, info ? RTT_COMMENT : RTT_RAW);
+ g_buffer_line_append_text(line, BLC_LAST_USED, text, len, info ? RTT_COMMENT : RTT_RAW, NULL);
free(text);
diff --git a/src/analysis/types/template.c b/src/analysis/types/template.c
index daeb454..974991a 100644
--- a/src/analysis/types/template.c
+++ b/src/analysis/types/template.c
@@ -240,18 +240,18 @@ static void g_template_type_output(const GTemplateType *type, GLangOutput *lang,
g_class_enum_type_output(G_CLASS_ENUM_TYPE(type), lang, line, info, full);
- g_buffer_line_insert_text(line, BLC_LAST_USED, "<", 1, info ? RTT_COMMENT : RTT_LTGT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, "<", 1, info ? RTT_COMMENT : RTT_LTGT, NULL);
for (i = 0; i < type->models_count; i++)
{
if (i > 0)
- g_buffer_line_insert_text(line, BLC_LAST_USED, ", ", 2, info ? RTT_COMMENT : RTT_SIGNS);
+ g_buffer_line_append_text(line, BLC_LAST_USED, ", ", 2, info ? RTT_COMMENT : RTT_SIGNS, NULL);
g_data_type_output(type->models[i], lang, line, info, full);
}
- g_buffer_line_insert_text(line, BLC_LAST_USED, ">", 1, info ? RTT_COMMENT : RTT_LTGT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, ">", 1, info ? RTT_COMMENT : RTT_LTGT, NULL);
}
diff --git a/src/analysis/variable.c b/src/analysis/variable.c
index d547281..e78c793 100644
--- a/src/analysis/variable.c
+++ b/src/analysis/variable.c
@@ -295,9 +295,9 @@ void g_binary_variable_output(const GBinVariable *var, GLangOutput *lang, GBuffe
if (var->name != NULL)
{
if (!g_data_type_is_pointer(var->type, true))
- g_buffer_line_insert_text(line, BLC_LAST_USED, " ", 1, RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, " ", 1, RTT_COMMENT, NULL);
- g_buffer_line_insert_text(line, BLC_LAST_USED, var->name, strlen(var->name), RTT_COMMENT);
+ g_buffer_line_append_text(line, BLC_LAST_USED, var->name, strlen(var->name), RTT_COMMENT, NULL);
}