summaryrefslogtreecommitdiff
path: root/plugins/arm
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-09-07 22:11:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-09-07 22:11:49 (GMT)
commitf663a08007095e58f60fcf9a815a8b3d31b87c83 (patch)
tree80da49384da78cb9f1b7f81e23e638e5d1dc054e /plugins/arm
parent39ceed9ed4e4484919f9eecc35d0b51372e5a233 (diff)
Rewritten some code managing comments.
Diffstat (limited to 'plugins/arm')
-rw-r--r--plugins/arm/v7/fetch.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/arm/v7/fetch.c b/plugins/arm/v7/fetch.c
index 876ad51..2d38cbf 100644
--- a/plugins/arm/v7/fetch.c
+++ b/plugins/arm/v7/fetch.c
@@ -33,6 +33,7 @@
#include <arch/instructions/raw.h>
#include <arch/operands/immediate.h>
#include <arch/operands/register.h>
+#include <common/extstr.h>
#include <format/known.h>
#include <format/format.h>
#include <format/preload.h>
@@ -389,6 +390,7 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
GArchInstruction *loaded; /* Instruction de valeur */
bool inserted; /* Bilan d'une insertion */
char *desc; /* Description d'accompagnement*/
+ size_t index; /* Indice d'un existant ? */
GDbComment *comment; /* Définition de commentaire */
GArchOperand *new; /* Instruction de ciblage */
@@ -494,30 +496,35 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
g_preload_info_lock_comments(info);
- comment = _g_preload_info_find_comment_at(info, &loaded_addr);
+ comment = g_preload_info_find_comment_at(info, &loaded_addr, &index);
- if (comment != NULL)
+ if (comment == NULL)
{
- g_db_comment_add_static_text(comment, "\n");
- g_db_comment_add_dynamic_text(comment, desc);
+ comment = g_db_comment_new(&loaded_addr, CET_INLINED, BLF_HAS_CODE, desc);
+ g_db_item_add_flag(G_DB_ITEM(comment), DIF_VOLATILE);
- g_object_unref(G_OBJECT(comment));
+ _g_preload_info_add_comment(info, comment);
}
else
{
- comment = g_db_comment_new_inlined(&loaded_addr, BLF_HAS_CODE, false);
- g_db_item_add_flag(G_DB_ITEM(comment), DIF_VOLATILE);
+ desc = strprep(desc, "\n");
+ desc = strprep(desc, g_db_comment_get_text(comment));
- g_db_comment_add_dynamic_text(comment, desc);
+ g_object_unref(G_OBJECT(comment));
- _g_preload_info_add_comment(info, comment);
+ comment = g_db_comment_new(&loaded_addr, CET_INLINED, BLF_HAS_CODE, desc);
+ g_db_item_add_flag(G_DB_ITEM(comment), DIF_VOLATILE);
+
+ g_preload_info_replace_comment_at(info, index, comment);
}
g_preload_info_unlock_comments(info);
+ free(desc);
+
}
/* Mise à jour de l'affichage et conclusion */