summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-07-12 22:47:38 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-07-12 22:47:38 (GMT)
commitd7f78fe9a75d96b6f3d441335dcf50a5c026d8ea (patch)
tree632744c467641825441b866c4f988c03d9c20cf1 /src/arch
parentbdda063b67d8c1d402f6dc17726fed0c800d3d1c (diff)
Taken into account that raw immediate values can be used more than once.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm/v7/fetch.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c
index 929c877..42788af 100644
--- a/src/arch/arm/v7/fetch.c
+++ b/src/arch/arm/v7/fetch.c
@@ -367,6 +367,7 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
uint32_t target; /* Adresse virtuelle visée */
vmpa2t pos; /* Tête de lecture de valeur */
VMPA_BUFFER(loc); /* Adresse au format texte */
+ GPreloadInfo *info; /* Informations préchargées */
GArchInstruction *loaded; /* Instruction de valeur */
char *desc; /* Description d'accompagnement*/
GDbComment *comment; /* Définition de commentaire */
@@ -439,18 +440,43 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
copy_vmpa(&pos, &loaded_addr);
- loaded = g_raw_instruction_new_from_value(&pos, MDS_32_BITS_UNSIGNED, target);
+ info = G_PRELOAD_INFO(context);
- g_preload_info_add_instruction(G_PRELOAD_INFO(context), loaded);
+ g_preload_info_lock_instructions(info);
+
+ if (!_g_preload_info_has_instruction_at(info, &loaded_addr))
+ {
+ loaded = g_raw_instruction_new_from_value(&pos, MDS_32_BITS_UNSIGNED, target);
+ _g_preload_info_add_instruction(info, loaded);
+ }
+
+ g_preload_info_unlock_instructions(info);
vmpa2_virt_to_string(get_mrange_addr(range), MDS_32_BITS, loc, NULL);
asprintf(&desc, _("Value used @ %s"), loc);
- comment = g_db_comment_new_inlined(&loaded_addr, BLF_HAS_CODE, false);
- g_db_comment_add_static_text(comment, desc);
- g_db_item_set_volatile(G_DB_ITEM(comment), true);
+ g_preload_info_lock_comments(info);
+
+ comment = _g_preload_info_find_comment_at(info, &loaded_addr);
+
+ if (comment != NULL)
+ {
+ g_db_comment_add_static_text(comment, "\n");
+ g_db_comment_add_dynamic_text(comment, desc);
+ }
+
+ else
+ {
+ comment = g_db_comment_new_inlined(&loaded_addr, BLF_HAS_CODE, false);
+ g_db_item_set_volatile(G_DB_ITEM(comment), true);
+
+ g_db_comment_add_dynamic_text(comment, desc);
+
+ _g_preload_info_add_comment(info, comment);
+
+ }
- g_preload_info_add_comment(G_PRELOAD_INFO(context), comment);
+ g_preload_info_unlock_comments(info);
/* Mise à jour de l'affichage et conclusion */