summaryrefslogtreecommitdiff
path: root/src/analysis/disass/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass/output.c')
-rw-r--r--src/analysis/disass/output.c75
1 files changed, 69 insertions, 6 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c
index fcbc0c6..5a74d92 100644
--- a/src/analysis/disass/output.c
+++ b/src/analysis/disass/output.c
@@ -38,6 +38,7 @@
* Paramètres : cache = tampon de récueil des résultats d'impression. *
* lang = langage de haut niveau préféré pour l'impression. *
* binary = tampon de récueil des résultats d'impression. *
+* info = informations complémentaires à intégrer. *
* status = barre de statut avec progression à mettre à jour. *
* *
* Description : Transcrit du code désassemblé en texte humainement lisible. *
@@ -48,7 +49,7 @@
* *
******************************************************************************/
-void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, GLoadedBinary *binary, GtkStatusStack *status)
+void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, GLoadedBinary *binary, GPreloadInfo *info, GtkStatusStack *status)
{
GExeFormat *format; /* Format associé au binaire */
GArchProcessor *proc; /* Processeur de l'architecture*/
@@ -64,6 +65,11 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
size_t count; /* Nombre total d'instructions */
activity_id_t id; /* Identifiant de progression */
bool expect_outro; /* Fin de zone de code définie */
+
+
+ GDbComment *comment; /* Commentaire à ajouter */
+ const vmpa2t *caddr; /* Localisation du commentaire */
+
size_t i; /* Boucle de parcours */
GArchInstruction *instr; /* Instruction à traiter */
const vmpa2t *iaddr; /* Adresse d'instruction */
@@ -78,7 +84,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
BufferLineFlags flags; /* Propriétés pour la ligne */
//mrange_t range; /* Couverture sans surface */
- GDbComment *comment; /* Commentaire à ajouter */
+ GDbComment *_comment; /* Commentaire à ajouter */
@@ -131,6 +137,20 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
expect_outro = false;
+ comment = g_preload_info_pop_comment(info);
+
+ if (comment != NULL)
+ caddr = g_db_comment_get_address(comment);
+
+
+ /*
+ if (comment != NULL)
+ log_variadic_message(LMT_BAD_BINARY,
+ _("Got comment '%s' @ 0x%08x"),
+ g_db_comment_get_text(comment), get_phy_addr(caddr));
+ */
+
+
for (i = 0; i < count; i++)
{
instr = g_arch_processor_get_instruction(proc, i);
@@ -184,7 +204,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
{
log_variadic_message(LMT_BAD_BINARY,
_("Unable to find a proper location for symbol '%s' @ 0x%08x"),
- g_binary_symbol_get_label(symbols[sym_index]), get_virt_addr(saddr));
+ g_binary_symbol_get_label(symbols[sym_index]), get_phy_addr(saddr));
_missing++;
@@ -261,18 +281,61 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang,
g_buffer_cache_append(cache, G_LINE_GENERATOR(instr), flags);
+
+
+ //////////////////////////////////
if (compared == 0)
{
/* Commentaire ? */
- comment = g_binary_symbol_get_comment(symbols[sym_index]);
+ _comment = g_binary_symbol_get_comment(symbols[sym_index]);
- if (comment != NULL)
- g_db_item_apply(G_DB_ITEM(comment), binary);
+ if (_comment != NULL)
+ g_db_item_apply(G_DB_ITEM(_comment), binary);
sym_index++;
}
+ ///////////////////////////////////////
+
+
+
+ /* Commentaire en bout de ligne ? */
+
+ if (comment != NULL)
+ {
+ compared = cmp_vmpa(iaddr, caddr);
+
+ if (compared == 0)
+ {
+ if (g_loaded_binary_add_to_collection(binary, G_DB_ITEM(comment)))
+ g_db_item_apply(G_DB_ITEM(comment), binary);
+
+ else
+ g_object_unref(G_OBJECT(comment));
+
+ }
+
+ else if (compared > 0)
+ {
+ log_variadic_message(LMT_BAD_BINARY,
+ _("Unable to find a proper location for comment '%s' @ 0x%08x"),
+ g_db_comment_get_text(comment), get_phy_addr(caddr));
+
+ g_object_unref(G_OBJECT(comment));
+
+ }
+
+ if (compared >= 0)
+ {
+ comment = g_preload_info_pop_comment(info);
+
+ if (comment != NULL)
+ caddr = g_db_comment_get_address(comment);
+
+ }
+
+ }
g_object_unref(G_OBJECT(instr));