Skip to content

Commit

Permalink
Load bin info in debugger and some doc/sys cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 23, 2012
1 parent 2c6de61 commit f473a4d
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 114 deletions.
50 changes: 0 additions & 50 deletions INSTALL

This file was deleted.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ the following command:

$ sys/install.sh

# Uninstall

In case of poluted filesystem you can uninstall current version or remove all previous installations:

$ make uninstall
$ make purge

# Bindings

All language bindings are under the r2-bindings directory.
Expand Down
13 changes: 11 additions & 2 deletions binr/radare2/radare2.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,17 @@ int main(int argc, char **argv) {
#if USE_THREADS
if (!rabin_th)
#endif
if (!r_core_bin_load (&r, NULL))
{
const char *filepath = NULL;
if (debug) {
// XXX: this is incorrect for PIE binaries
filepath = strstr (file, "://");
if (filepath) filepath += 3;
else filepath = file;
}
if (!r_core_bin_load (&r, filepath))
r_config_set (r.config, "io.va", "false");
}
}
if (run_rc) {
char *homerc = r_str_home (".radare2rc");
Expand All @@ -310,7 +319,7 @@ int main(int argc, char **argv) {
return 1;
}
pid = *p; // 1st element in debugger's struct must be int
r_core_cmd (&r, "e io.ffio=true", 0);
r_config_set (r.config, "io.ffio", "true");
if (is_gdb) r_core_cmd (&r, "dh gdb", 0);
else r_core_cmdf (&r, "dh %s", debugbackend);
r_core_cmdf (&r, "dpa %d", pid);
Expand Down
2 changes: 1 addition & 1 deletion configure.hook
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
case "$1" in
--version|--help)
--report|-r|--version|--help)
: # nothing to do here
;;
*)
Expand Down
3 changes: 2 additions & 1 deletion doc/maemo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

* Compile

./configure --without-ssl --prefix=/usr --with-little-endian
./configure --without-ssl --prefix=/usr --with-little-endian \
--with-compiler=mad --with-ostype=gnulinux
make

* Create the package
Expand Down
8 changes: 4 additions & 4 deletions man/rabin2.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.Nd Binary program info extractor
.Sh SYNOPSIS
.Nm rabin2
.Op Fl ACeisSMzIHlRrvLxVh
.Op Fl ACeisSMzIHlRrLxvVh
.Op Fl a Ar arch
.Op Fl b Ar bits
.Op Fl B Ar addr
Expand Down Expand Up @@ -52,11 +52,11 @@ Show address of 'main' symbol
Show strings inside .data section (like gnu strings does)
.It Fl I
Show binary info
.It Fl I
.It Fl H
Show header fields
.It Fl l
List linked libraries to the binary
.It Fl I
.It Fl R
Show realocations
.It Fl O Ar str
Write/extract operations (\-O help)
Expand Down Expand Up @@ -97,7 +97,7 @@ Get entrypoint
.Pp
Load symbols and imports from radare
.Pp
.!rabin2 -rsi a.out
.!rabin2 -vrsi a.out
.Sh SEE ALSO
.Pp
.Xr rahash2(1) ,
Expand Down
91 changes: 38 additions & 53 deletions build.sh → sys/farm.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
[ -z "${MAKE}" ] && MAKE=make
[ -z "${NAME}" ] && NAME=radare2
[ -z "${DIR}" ] && DIR=radare2.build
[ -z "${URL}" ] && URL=http://radare.org/hg/${NAME}
[ -z "${URL}" ] && URL=http://github.com/radare/${NAME}
PYTHON=python2
WD=${PWD}/${DIR}
NOW=$(date +%Y%m%d-%H%M%S)
if [ -z "$1" ]; then
Expand Down Expand Up @@ -47,22 +48,15 @@ logcmd() {
eval "( $@ ; logchk $? ) ${DOLOG}"
}

registerpurge() {
if [ -z "`grep purge ~/.hgrc 2>/dev/null`" ]; then
echo '[extensions]' >> ~/.hgrc
echo 'purge=' >> ~/.hgrc
fi
}

r2deinstall() {
r2uninstall() {
cd radare2
make deinstall DESTDIR=${DESTDIR}
make uninstall DESTDIR=${DESTDIR}
}

installdeps() {
VALA=vala-0.10.1
VALA=vala-0.18.0

echo "I am going to install ${VALA} and valaswig..."
echo "I am going to install ${VALA} and valabind..."
sleep 2

wget -c http://download.gnome.org/sources/vala/0.9/${VALA}.tar.bz2
Expand All @@ -80,14 +74,14 @@ installdeps() {
echo "Cannot find 'swig'. apt-get install swig or get it from svn"
echo "svn co https://swig.svn.sourceforge.net/svnroot/swig/trunk swig"
else
if [ -d valaswig ]; then
cd valaswig
registerpurge
hg purge --all
hg pull -u
if [ -d valabind ]; then
cd valabind
git reset --hard
git clean -xdf
git pull
else
hg clone http://hg.youterm.com/valaswig
cd valaswig
git clone http://github.com/radare/valabind
cd valabind
fi
chmod +x configure
./configure --prefix=/usr
Expand All @@ -97,14 +91,14 @@ installdeps() {
fi
}

deinstalldeps() {
uninstalldeps() {
VALA=`cat ${WD}/version.vala`
cd ${VALA}
${MAKE} deinstall DESTDIR=${DESTDIR}
${MAKE} uninstall DESTDIR=${DESTDIR}
cd ..
rm -rf ${VALA} ${VALA}.tar.bz2
cd valaswig
${MAKE} deinstall DESTDIR=${DESTDIR}
cd valabind
${MAKE} uninstall DESTDIR=${DESTDIR}
}

mkdir -p ${DIR}
Expand All @@ -126,7 +120,7 @@ case "$1" in
exit 1
fi
DESTDIR="$2"
r2deinstall
r2uninstall
exit 0
;;
"-d")
Expand All @@ -144,7 +138,7 @@ case "$1" in
exit 1
fi
DESTDIR="$2"
deinstalldeps
uninstalldeps
exit 0
;;
"-c")
Expand All @@ -156,22 +150,22 @@ case "$1" in
cat<<EOF
Usage: build.sh [logfile|-option]
-i [destdir] install r2
-I [destdir] deinstall r2
-I [destdir] uninstall r2
-c clean build directory
-d [destdir] compile and install dependencies
-D [destdir] deinstall dependencies
-D [destdir] uninstall dependencies
-h show this help
Dependencies:
vala http://live.gnome.org/Vala
swig http://www.swig.org/
valaswig http://hg.youterm.com/valaswig
valabind http://github.com/radare/valabind
Examples:
sh build.sh do the build and generate log
sudo sh build.sh -i / install system-wide (/+/usr)
sudo sh build.sh -I deinstall
sudo sh build.sh -d / install dependencies system-wide
sh build.sh -d ~/prefix install dependencies in home
sudo sh build.sh -c clean build directory
sys/farm.sh do the build and generate log
sudo sys/farm.sh -i / install system-wide (/+/usr)
sudo sys/farm.sh -I uninstall
sudo sys/farm.sh -d / install dependencies system-wide
sys/farm.sh -d ~/prefix install dependencies in home
sudo sys/farm.sh -c clean build directory
rm -rf radare2.build remove build directory
EOF
exit 0
Expand All @@ -186,19 +180,10 @@ date >> ${LOGFILE}
uname -a >> ${LOGFILE}
cat /proc/cpuinfo >> ${LOGFILE}

type hg > /dev/null 2>&1
type git > /dev/null 2>&1
if [ ! $? = 0 ]; then
cat <<EOF
Cannot find 'hg'. Please install mercurial:
# easy_install mercurial
or
$ apt-get install mercurial
or
$ wget http://mercurial.selenic.com/downloads
$ tar xzvf mercurial-*.tar.gz
$ cd mercurial-*
$ python setup.py build
$ sudo python setup.py install
Cannot find 'git'.
EOF
exit 1
fi
Expand All @@ -208,15 +193,15 @@ log "[==] Working directory: $WD/$DIR"
if [ -d "${NAME}" ]; then
log "[==] Cleaning up old build directory..."
cd ${NAME}
registerpurge
hg purge --all
git clean -xdf
git reset --hard

log "[==] Updating repository to HEAD..."
logcmd hg revert -a
logcmd hg pull -u
else
log "[==] Checking out from ${URL}..."
hg clone ${URL} 2>&1 | tee -a ${LOGFILE}
git clone ${URL} 2>&1 | tee -a ${LOGFILE}
cd ${NAME}
fi

Expand Down Expand Up @@ -263,21 +248,21 @@ fi
log "[==] Installing in ${PREFIX}"
logcmd time ${MAKE} install DESTDIR="${DESTDIR}"

log "[==] Configuring valaswig bindings..."
log "[==] Configuring valabind bindings..."
cd swig
logcmd time ./configure --prefix=${PREFIX}

log "[==] Compiling swig/..."
logcmd time ${MAKE} ${MAKEFLAGS}

log "[==] Installing valaswig bindings..."
log "[==] Installing valabind bindings..."
logcmd time ${MAKE} install DESTDIR=${DESTDIR}

log "[==] Testing bindings.."
export PYTHONPATH=${DESTDIR}/${PREFIX}/lib/python2.5/site-packages/
logcmd python -c "'from r2.r_util import *;b=RBuffer()'"
logcmd python -c "'from r2.r_asm import *;a=RAsm()'"
logcmd python -c "'from r2.r_core import *;c=RCore()'"
logcmd ${PYTHON} -c "'from r2.r_util import *;b=RBuffer()'"
logcmd ${PYTHON} -c "'from r2.r_asm import *;a=RAsm()'"
logcmd ${PYTHON} -c "'from r2.r_core import *;c=RCore()'"
# TODO. add more tests here

# back to root dir
Expand Down
6 changes: 3 additions & 3 deletions maemo/Makefile → sys/maemo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ PACKAGE_DIR=${PWD}
SOURCE_DIR = .
ICON_SOURCE =
#ICON_SOURCE =${SOURCE_DIR}/maemo_deb/exaile26.png
PRG=../../build/default/
PRG=../../
SPRG=../../
PRG=../../../build/default/
PRG=../../../
SPRG=../../../

all:
sudo rm -rf control data
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f473a4d

Please sign in to comment.