summaryrefslogtreecommitdiff
path: root/src/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-08-31 20:49:30 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-08-31 20:49:30 (GMT)
commitada3040b9b2b6d0a2d6e2157b3f79e772e36b2d7 (patch)
treeb83827a15339d01870c21b181bc9b10ac58451ac /src/binary.c
parenta9e504c2e6e07d29cee620b3d34492e002d1680e (diff)
Looked for symbols of function.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@23 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/binary.c')
-rw-r--r--src/binary.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/binary.c b/src/binary.c
index 862a4d0..b7ee15a 100644
--- a/src/binary.c
+++ b/src/binary.c
@@ -25,6 +25,7 @@
#include <fcntl.h>
+#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -165,14 +166,23 @@ void fill_snippet(GtkSnippet *snippet)
- comments_count = get_dwarf_comments(dformat, &comments, &offsets);
+ //comments_count = get_dwarf_comments(dformat, &comments, &offsets);
+
+ comments = NULL;
+ offsets = NULL;
+ comments_count = 0;
+
+ get_elf_symbol_comments(format, &comments, &offsets, &comments_count);
comments_list = (code_line_info **)calloc(comments_count, sizeof(code_line_info *));
for (i = 0; i < comments_count; i++)
comments_list[i] = create_code_line_info(offsets[i], NULL, strdup(comments[i]));
- i = 0;
+
+ qsort(comments_list, comments_count, sizeof(code_line_info *), compare_code_line_info);
+
+
find_exe_section(format, ".text", &pos, &len, &base);
@@ -187,6 +197,9 @@ void fill_snippet(GtkSnippet *snippet)
offset = base;
+ for (i = 0; i < comments_count; i++)
+ if (comments_list[i]->offset >= base) break;
+
gtk_snippet_set_processor(snippet, proc);
@@ -206,7 +219,7 @@ void fill_snippet(GtkSnippet *snippet)
offset = base + pos;
/* Si on a un commentaire pour cette ligne... */
- if (comments_count > 0 && offsets[i] == offset)
+ if (i < comments_count && comments_list[i]->offset == offset)
{
list = (code_line_info **)realloc(list, ++list_len * sizeof(code_line_info *));
list[list_len - 1] = comments_list[i++];
@@ -232,8 +245,10 @@ void fill_snippet(GtkSnippet *snippet)
/* TODO: free() */
}
- ret = munmap(bin_data, length);
+ /****
+ ret = munmap(bin_data, length);
+ ****/
/*
gtk_snippet_build_content(snippet);