| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#include "config.h" |
| 12 |
|
| 13 |
#include <stdlib.h> |
| 14 |
#include <stdio.h> |
| 15 |
#include <sys/utsname.h> |
| 16 |
#include <bfd.h> |
| 17 |
#include <string.h> |
| 18 |
#include <unistd.h> |
| 19 |
#include <sys/types.h> |
| 20 |
#include <sys/stat.h> |
| 21 |
|
| 22 |
#include "lookup.h" |
| 23 |
|
| 24 |
|
| 25 |
static int lookup_bfd_init(void) |
| 26 |
{ |
| 27 |
struct utsname uts; |
| 28 |
struct stat sb; |
| 29 |
char *dbibuf; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
if(uname(&uts)<0) |
| 36 |
return-1; |
| 37 |
|
| 38 |
dbibuf = malloc(strlen("/usr/lib/debug/lib/modules/") + sizeof(uts.release)); |
| 39 |
sprintf(dbibuf,"/usr/lib/debug/lib/modules/%s", uts.release); |
| 40 |
if (stat(dbibuf,&sb) < 0) { |
| 41 |
free(dbibuf); |
| 42 |
goto out_fail; |
| 43 |
} |
| 44 |
|
| 45 |
free(dbibuf); |
| 46 |
|
| 47 |
|
| 48 |
bfd_init(); |
| 49 |
return 0; |
| 50 |
|
| 51 |
out_fail: |
| 52 |
return-1; |
| 53 |
} |
| 54 |
|
| 55 |
static int lookup_bfd_sym(void *pc, struct loc_result *location) |
| 56 |
{ |
| 57 |
return 1; |
| 58 |
} |
| 59 |
|
| 60 |
struct lookup_methods bfd_methods = { |
| 61 |
lookup_bfd_init, |
| 62 |
lookup_bfd_sym, |
| 63 |
}; |