summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-06-18 21:54:00 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-06-18 21:54:00 (GMT)
commit7d7f7da400e78cd562fd02ed668ea2b677b219be (patch)
tree043abeb06925c4d3b675eb88d110a2b0e3dd4dbf /plugins
parentb23f4e88e2e1fbdc9a0849a30d42cf81b915d79d (diff)
Extended any existing comment when documenting syscalls.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/lnxsyscalls/writer.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/plugins/lnxsyscalls/writer.c b/plugins/lnxsyscalls/writer.c
index 1263429..caa5501 100644
--- a/plugins/lnxsyscalls/writer.c
+++ b/plugins/lnxsyscalls/writer.c
@@ -197,25 +197,42 @@ void write_all_comments(comment_writer *writer, GPreloadInfo *preload)
size_t i; /* Boucle de parcours #1 */
comment_data *target; /* Commentaire à éditer */
GDbComment *comment; /* Commentaire final à intégrer*/
+ bool new; /* Nature du commentaire */
size_t k; /* Boucle de parcours #2 */
for (i = 0; i < writer->count; i++)
{
target = &writer->comments[i];
- comment = g_db_comment_new_inlined(&target->addr, BLF_HAS_CODE, false);
- g_db_item_set_volatile(G_DB_ITEM(comment), true);
+ g_preload_info_lock_comments(preload);
+
+ comment = _g_preload_info_find_comment_at(preload, &target->addr);
+
+ new = (comment == NULL);
+
+ if (comment == NULL)
+ {
+ comment = g_db_comment_new_inlined(&target->addr, BLF_HAS_CODE, false);
+ g_db_item_set_volatile(G_DB_ITEM(comment), true);
+
+ g_object_ref(G_OBJECT(comment));
+
+ _g_preload_info_add_comment(preload, comment);
+
+ }
+
+ g_preload_info_unlock_comments(preload);
for (k = 0; k < target->count; k++)
{
- if (k > 0)
+ if (k > 0 || !new)
g_db_comment_add_static_text(comment, " / ");
g_db_comment_add_dynamic_text(comment, strdup(target->text[k]));
}
- g_preload_info_add_comment(preload, comment);
+ g_object_unref(G_OBJECT(comment));
}