mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-22 23:31:26 +00:00
* Some ideas for the code analysis module
* Fix r_iter_last() - Some more work on the Vala integration * Grep for README and TODO for hg-miss
This commit is contained in:
parent
624f5c68ea
commit
bca428f994
15
libr/anal/README
Normal file
15
libr/anal/README
Normal file
@ -0,0 +1,15 @@
|
||||
Code analysis module
|
||||
====================
|
||||
|
||||
Analysis an = new Analysis ();
|
||||
an.set ("x86");
|
||||
an.set_bytes (buf, 1024);
|
||||
an.analyze ();
|
||||
var foo = an.get_function_preludes ();
|
||||
var calls = an.get_calls ();
|
||||
foreach var (calls) {
|
||||
stdout.printf("0x%llx: call 0x%llx", var.from, var.to);
|
||||
for(int i=0;i<var.args;i++) {
|
||||
stdout.printf("arg%d: %s\n" i, var.arg[i]);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
#define r_iter_next_n(x,y) x+y
|
||||
#define r_iter_prev(x) (--it==*it)?0:it
|
||||
#define r_iter_delete(x) for(;*x;x++)*x=*(x+1)
|
||||
#define r_iter_last(x) (*x!=0)
|
||||
#define r_iter_last(x) (*x==0)
|
||||
R_API void **r_iter_new(int n);
|
||||
R_API void **r_iter_first(void **it);
|
||||
R_API void r_iter_foreach(void **it, int (*callback)(void *, void *), void *user);
|
||||
|
@ -42,7 +42,7 @@ R_API void r_iter_delete(void **it)
|
||||
|
||||
R_API int r_iter_last(void **it)
|
||||
{
|
||||
return (*it != NULL);
|
||||
return (*it == NULL);
|
||||
}
|
||||
|
||||
R_API void **r_iter_first(void **it)
|
||||
|
@ -19,6 +19,7 @@ namespace Radare {
|
||||
X86 = 0, PPC, ARM, MIPS, SPARC
|
||||
}
|
||||
|
||||
public Syscall();
|
||||
public void setup(int os, int arch);
|
||||
public void setup_file(string file);
|
||||
public int get(string syscall);
|
||||
|
@ -19,19 +19,19 @@ namespace Radare {
|
||||
}
|
||||
|
||||
/* Generic Iterator interfaced with r_iter */
|
||||
//[Compact]
|
||||
[Compact]
|
||||
[CCode (cprefix="r_iter_")]
|
||||
public class Iter<G> {
|
||||
public Iter (int size);
|
||||
public unowned G get ();
|
||||
public unowned G next ();
|
||||
public unowned G next_n (int idx);
|
||||
public Iter<G> next ();
|
||||
public unowned Iter<G> next_n (int idx);
|
||||
public unowned G prev ();
|
||||
public void delete ();
|
||||
public G first ();
|
||||
public unowned G first ();
|
||||
public bool last ();
|
||||
// TODO: foreach()
|
||||
public G free ();
|
||||
public unowned G free ();
|
||||
public void set (int idx, G data);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
all: core hash sc socket asm search bin db
|
||||
all: core hash sc socket asm search iter bin db
|
||||
@true
|
||||
|
||||
genie:
|
||||
@ -8,6 +8,9 @@ genie:
|
||||
db:
|
||||
valac --vapidir=${PWD}/.. --pkg r_db db.vala
|
||||
|
||||
iter:
|
||||
valac --vapidir=${PWD}/.. --pkg r_util iter.vala
|
||||
|
||||
sc:
|
||||
valac -C --vapidir=${PWD}/.. sc.vala --pkg r_syscall
|
||||
gcc sc.c `pkg-config gobject-2.0 --libs --cflags` -I../../include/ -lr_syscall -Wl,-R../../syscall -L../../syscall -o sc
|
||||
|
@ -1,7 +1,9 @@
|
||||
using Radare;
|
||||
|
||||
public class IterableObject : Radare.Iter {
|
||||
public string name { get;set; }
|
||||
//public class IterableObject<G> : Radare.Iter<G> : base(number) {
|
||||
[Compact]
|
||||
public class IterableObject {
|
||||
public string name; // { get;set; }
|
||||
|
||||
public IterableObject(string name) {
|
||||
this.name = name;
|
||||
@ -10,7 +12,7 @@ public class IterableObject : Radare.Iter {
|
||||
|
||||
Radare.Iter<IterableObject> get_iter_list ()
|
||||
{
|
||||
Radare.Iter<IterableObject> list = new Radare.Iter<IterableObject>(3);
|
||||
Radare.Iter<unowned IterableObject> list = new Radare.Iter<unowned IterableObject>(3);
|
||||
list.set(0, new IterableObject("patata"));
|
||||
list.set(1, new IterableObject("barata"));
|
||||
list.set(2, new IterableObject("lalata"));
|
||||
@ -19,9 +21,13 @@ Radare.Iter<IterableObject> get_iter_list ()
|
||||
|
||||
void main()
|
||||
{
|
||||
Radare.Iter<IterableObject> foo = get_iter_list ();
|
||||
while (!foo.last ()) {
|
||||
Radare.Iter<unowned IterableObject> foo = get_iter_list ();
|
||||
//Radare.Iter<IterableObject> ptr = foo;
|
||||
//for(Radare.Iter<IterableObject> ptr = foo; !ptr.last(); ptr = ptr.next()) {
|
||||
while(!foo.last()) {
|
||||
//unowned IterableObject io = foo.get ();
|
||||
unowned IterableObject io = foo.get ();
|
||||
stdout.printf("name: %s\n", io.name);
|
||||
foo = foo.next();
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,7 @@
|
||||
hg-miss:
|
||||
@-hg st . | grep -e vala$$ -e mk$$ | grep ^? | grep -v config-user | cut -c 2- || true
|
||||
@-hg st . | grep -e \\.c$$ -e \\.h$$ | grep -v vapi | grep ^? | grep -v r_userconf | cut -c 2- || true
|
||||
@-hg st . | grep -e \\.vapi$$ | grep ^? | cut -c 2- || true
|
||||
@-hg st . | grep -e \\.acr$$ | grep ^? | cut -c 2- || true
|
||||
@-hg st . | grep -e \\.vapi$$ -e \\.acr$$ -e README$$ -e TODO$$ | grep ^? | cut -c 2- || true
|
||||
|
||||
FILES?=
|
||||
hg-locdiff:
|
||||
|
Loading…
x
Reference in New Issue
Block a user