diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-03-04 01:38:27 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-03-04 01:38:27 (GMT) |
commit | 674739bedc853681be5a2657a7a4f497d6e82c9b (patch) | |
tree | 10e65041c0607d4e5a20c0a7a77fe75e1bbd7737 /src/binary.c | |
parent | bbd04bf5f23e7dca1917247cb92824805b22a2a4 (diff) |
Added a line type for binary code display.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@51 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/binary.c')
-rw-r--r-- | src/binary.c | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/binary.c b/src/binary.c index 16be5ef..d55eb4a 100644 --- a/src/binary.c +++ b/src/binary.c @@ -444,6 +444,7 @@ void fill_snippet(GtkSnippet *snippet, GtkWidget *panel, GtkWidget *panel2) size_t comments_count; code_line_info **comments_list; + rendering_line *lines; rendering_line *line; code_line_info **list; @@ -463,6 +464,8 @@ void fill_snippet(GtkSnippet *snippet, GtkWidget *panel, GtkWidget *panel2) size_t k; + disass_options options; + proc = create_x86_processor(); pos = 0; @@ -490,10 +493,61 @@ void fill_snippet(GtkSnippet *snippet, GtkWidget *panel, GtkWidget *panel2) //exit(0); - line = build_binary_prologue("/tmp/hello", bin_data, length); + lines = build_binary_prologue("/tmp/hello", bin_data, length); + + + + options.show_address = true; + options.show_code = true; + + options.format = format; + options.proc = proc; + + + parts = get_elf_default_code_parts(format, &parts_count); + + + for (i = 0; i < parts_count; i++) + { + get_bin_part_values(parts[i], &pos, &len, &base); + + + + start = pos; + pos = 0; + + while (pos < len) + { + offset = base + pos; + + + instr = decode_instruction(proc, &bin_data[start], &pos, len, start, offset); + + + line = create_code_line(instr, &options); + add_line_to_rendering_lines(&lines, line); + + } + + + /**** + ret = munmap(bin_data, length); + ****/ + + /* + gtk_snippet_build_content(snippet); + */ + + } + + + + + + - gtk_snippet_set_rendering_lines(snippet, line); + gtk_snippet_set_rendering_lines(snippet, lines); return; |