Permalink
Browse files

Better webui, 'pi' counts opcodes and remove /new and htmlgraph

pi honors number of instructions, not bytes
Remove htmlgraph and lungo webui
More work on the enyo webui
  • Loading branch information...
1 parent 98da9c8 commit 1f6174c6ae7e1275908bc492960bc10bd68dfc98 @radare committed Jan 25, 2013
Showing with 136 additions and 4,091 deletions.
  1. +1 −1 libr/core/cmd_print.c
  2. +0 −3 libr/core/config.c
  3. +15 −11 libr/core/disasm.c
  4. BIN mk/htmlgraph/arrow.gif
  5. BIN mk/htmlgraph/arrow_d.gif
  6. BIN mk/htmlgraph/arrow_l.gif
  7. BIN mk/htmlgraph/arrow_r.gif
  8. BIN mk/htmlgraph/arrow_u.gif
  9. +0 −158 mk/htmlgraph/htmlgraph.sh
  10. +0 −183 mk/htmlgraph/jsgraph.css
  11. +0 −1,821 mk/htmlgraph/jsgraph.js
  12. +1 −0 prefix/bin/rabin2
  13. +1 −0 prefix/bin/radare2
  14. +1 −0 prefix/bin/rahash2
  15. +1 −0 prefix/bin/rax2
  16. +1 −0 prefix/lib/libr_asm.dylib
  17. +1 −0 prefix/lib/libr_bin.dylib
  18. +14 −1 shlr/www/enyo/index.css
  19. +1 −1 shlr/www/enyo/index.js
  20. +49 −8 shlr/www/enyo/js/disassembler.js
  21. +25 −15 shlr/www/enyo/js/leftpanel.js
  22. +8 −7 shlr/www/enyo/js/mainpanel.js
  23. +8 −8 shlr/www/enyo/js/r2.js
  24. +2 −1 shlr/www/enyo/js/rightpanel.js
  25. +5 −3 shlr/www/{new → enyo}/r2ui.js
  26. +2 −0 shlr/www/graph/sf-homepage.css
  27. +0 −65 shlr/www/new/app.css
  28. +0 −59 shlr/www/new/app/aside.html
  29. +0 −37 shlr/www/new/app/asm.html
  30. +0 −24 shlr/www/new/app/console.html
  31. +0 −39 shlr/www/new/app/disasm.html
  32. +0 −14 shlr/www/new/app/hexdump.html
  33. +0 −27 shlr/www/new/app/logs.html
  34. +0 −14 shlr/www/new/app/sections.html
  35. +0 −87 shlr/www/new/app/settings.html
  36. +0 −15 shlr/www/new/app/symbols.html
  37. BIN shlr/www/new/icon.png
  38. +0 −101 shlr/www/new/index.html
  39. +0 −1 shlr/www/new/lungo.css
  40. +0 −129 shlr/www/new/lungo.icon.brand.css
  41. +0 −205 shlr/www/new/lungo.icon.css
  42. +0 −41 shlr/www/new/lungo.js
  43. +0 −567 shlr/www/new/lungo.theme.default.css
  44. +0 −26 shlr/www/new/quo.js
  45. +0 −127 shlr/www/new/r2.js
  46. +0 −14 shlr/www/new/style.css
  47. +0 −13 shlr/www/new/two
  48. +0 −265 shlr/www/new/window.js
View
@@ -211,7 +211,7 @@ static int cmd_print(void *data, const char *input) {
}
break;
case 'i':
- r_core_print_disasm_instructions (core, len, l);
+ r_core_print_disasm_instructions (core, core->blocksize, l);
break;
case 'D':
case 'd':
View
@@ -631,9 +631,6 @@ R_API int r_core_config_init(RCore *core) {
#endif
r_config_desc (cfg, "cfg.editor", "Select default editor program");
free (p);
- if (r_file_exists ("/usr/bin/htmlgraph.sh"))
- r_config_set (cfg, "cmd.graph", "!htmlgraph.sh a.dot");
- else
if (r_file_exists ("/usr/bin/xdot"))
r_config_set (cfg, "cmd.graph", "!xdot a.dot");
else
View
@@ -879,6 +879,7 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int len) {
R_API int r_core_print_disasm_instructions (RCore *core, int len, int l) {
RAsmOp asmop;
+ char *opstr, *tmpopstr;
int i, j, ret, err = 0;
const ut8 *buf = core->block;
int bs = core->blocksize;
@@ -887,11 +888,10 @@ R_API int r_core_print_disasm_instructions (RCore *core, int len, int l) {
int decode = r_config_get_i (core->config, "asm.decode");
ut64 at;
-// TODO: add support for anal hints
if (len>core->blocksize)
r_core_block_size (core, len);
if (l==0) l = len;
- for (i=j=0; i<bs && i<len && j<len; i+=ret, j++) {
+ for (i=j=0; i<bs && i<len && j<l; i+=ret, j++) {
at = core->offset +i;
if (hint) {
r_anal_hint_free (hint);
@@ -902,19 +902,23 @@ R_API int r_core_print_disasm_instructions (RCore *core, int len, int l) {
ret = r_asm_disassemble (core->assembler,
&asmop, buf+i, core->blocksize-i);
//r_cons_printf ("0x%08"PFMT64x" ", core->offset+i);
- if (ret<1) {
- ret = err = 1;
- r_cons_printf ("???\n");
+ if (hint && hint->length)
+ ret = hint->length;
+ if (hint && hint->opcode) {
+ opstr = strdup (hint->opcode);
} else {
if (decode) {
- char *tmpopstr, *opstr;
- r_anal_op (core->anal, &analop, at,
- buf+i, core->blocksize-i);
+ r_anal_op (core->anal, &analop, at, buf+i, core->blocksize-i);
tmpopstr = r_anal_op_to_string (core->anal, &analop);
opstr = (tmpopstr)? tmpopstr: strdup (asmop.buf_asm);
- r_cons_printf ("%s\n", opstr);
- free (opstr);
- } else r_cons_printf ("%s\n", asmop.buf_asm);
+ } else opstr = strdup (asmop.buf_asm);
+ }
+ if (ret<1) {
+ ret = err = 1;
+ r_cons_printf ("???\n");
+ } else {
+ r_cons_printf ("%s\n", opstr);
+ free (opstr);
}
}
if (hint) r_anal_hint_free (hint);
View
Deleted file not rendered
View
Deleted file not rendered
View
Deleted file not rendered
View
Deleted file not rendered
View
Deleted file not rendered
View
@@ -1,158 +0,0 @@
-#!/bin/sh
-#
-# e scr.html=true
-# e cmd.graph=!htmlgraph.sh
-# af
-# agv $$
-#
-
-D=`dirname $0`
-P=`basename $0`
-L=`readlink $D/$P`
-if [ -n "$L" ]; then
- D=`dirname $L`
- P=`basename $L`
-fi
-
-# TODO: handle this correctly
-if [ -n "$1" ]; then DOTFILE="$1" ; fi
-if [ -n "${DOTFILE}" -a ! -e "${DOTFILE}" ] ; then
- echo "cannot find ${DOTFILE}"
- exit 1
-fi
-
-T=`mktemp /tmp/htmlg.XXXXXX`.html
-
-cat <<EOF >>$T
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>js-graph.it homepage</title>
-<script type="text/javascript" src="jsgraph.js"></script>
-<link rel="stylesheet" type="text/css" href="jsgraph.css" />
-<style>
-p{
- white-space: pre;
- font-family: monospace;
- display: block;
-}
-body{
- overflow:hidden;
-}
-</style>
-<script>
- <!--
- function onLoad()
- {
- setMenu();
- resizeCanvas();
- initPageObjects();
- }
-
- /**
- * Resizes the main canvas to the maximum visible height.
- */
- function resizeCanvas()
- {
- var divElement = document.getElementById("mainCanvas");
- var screenHeight = window.innerHeight || document.body.offsetHeight;
- divElement.style.height = (screenHeight - 16) + "px";
- }
-
- /**
- * sets the active menu scanning for a menu item which url is a prefix
- * of the one of the current page ignoring file extension.
- * Nice trick!
- */
- function setMenu()
- {
- var url = document.location.href;
- // strip extension
- url = stripExtension(url);
-
- var ulElement = document.getElementById("menu");
- var links = ulElement.getElementsByTagName("A");
- var i;
- for(i = 0; i < links.length; i++)
- {
- if(url.indexOf(stripExtension(links[i].href)) == 0)
- {
- links[i].className = "active_menu";
- return;
- }
- }
- }
-
- /**
- * Strips the file extension and everything after from a url
- */
- function stripExtension(url)
- {
- var lastDotPos = url.lastIndexOf('.');
- if(lastDotPos > 0)
- return url.substring(0, lastDotPos - 1);
- else
- return url;
- }
-
- /**
- * this function opens a popup to show samples during explanations.
- */
- function openSample(url)
- {
- var popup = window.open(url, "sampleWindow", "width=400,height=300");
- popup.focus();
- return false;
- }
- //-->
-</script>
-</head>
-<body onload="onLoad();">
-<!--
-<table class="main_table" style="height: 100%;">
-<tr>
-<td colspan=3>
- <a href=''>File</a> | Edit
-</td>
-</tr>
- <tr>
- <td width="1" style="vertical-align: top;" class="menu">
- <ul id="menu">
-<select>
-<option>Functions</option>
-<option>Exports</option>
-<option>Imports</option>
-</select>
-
-</ul>
-</td>
-<td style="vertical-align: top; padding: 0px;">
--->
-<div id="mainCanvas" class="canvas" style="width: 100%; height: 400px;">
-EOF
-
-cat ${DOTFILE} >> $T
-
-cat <<EOF >> $T
-<!--
-</td>
-<td width="1" style="vertical-align: top;" class="menu">
-<ul id="menu"> </ul>
-</td>
-</tr>
-</table>
--->
-</body>
-</html>
-EOF
-
-cd /tmp
-cp -f $D/* .
-if [ -e /usr/bin/open ]; then
- open $T
-elif [ -e /usr/bin/xdg-open ]; then
- xdg-open $T
-else
- firefox $T
-fi
Oops, something went wrong.

0 comments on commit 1f6174c

Please sign in to comment.