radare2/libr/bin/bin_meta.c
Nibble 793dae395d * Massive refactoring of r_bin
- Add support for fatbins (currently only fatmach0)
  - Minimize creation of r_buffers
* rabin2
  - Add flag -A for listing archs
  - Add flags -a and -B for selecting arch
  - In the next commit -A and -B will be removed and -a will work
    with the following format:
    [-a arch bits] for selecting arch
	[-a] for listing them

--HG--
rename : libr/bin/p/bin_fatmach0.c => libr/bin/p/bin_xtr_fatmach0.c
2010-09-24 21:23:13 +02:00

25 lines
811 B
C

/* radare - LGPL - Copyright 2009-2010 nibble<.ds@gmail.com> */
#include <r_types.h>
#include <r_bin.h>
R_API int r_bin_meta_get_line(RBin *bin, ut64 addr, char *file, int len, int *line) {
if (bin->curarch && bin->curarch->curplugin && bin->curarch->curplugin->meta) {
// XXX quick hack to not show lines out of opened bin
if (addr >= bin->curarch->baddr && addr < (bin->curarch->baddr+bin->curarch->size))
if (bin->curarch->curplugin->meta->get_line)
return bin->curarch->curplugin->meta->get_line (bin->arch, addr,
file, len, line);
}
return R_FALSE;
}
R_API char *r_bin_meta_get_source_line(RBin *bin, ut64 addr) {
char file[4096];
int line;
char *out = NULL;
if (r_bin_meta_get_line (bin, addr, file, sizeof (file), &line))
out = r_file_slurp_line (file, line, 0);
return out;
}