summaryrefslogtreecommitdiffstats
path: root/dwarf-extract-struct.c
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-10-03 16:45:58 +0900
committerDominique Martinet <asmadeus@codewreck.org>2017-10-03 16:45:58 +0900
commit606478ad2a706b857eae5de89f3ce3d444276f73 (patch)
tree381f246c2115458b2948cef578872fbad842959b /dwarf-extract-struct.c
parent745feb05f35dd35fea386f7008c82edadd3166a3 (diff)
fix Makefile/compilation, make header include libdwarf/*dwarf.h instead of *dwarf.h
Diffstat (limited to 'dwarf-extract-struct.c')
-rw-r--r--dwarf-extract-struct.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/dwarf-extract-struct.c b/dwarf-extract-struct.c
index b6ef87f..7e9bb2c 100644
--- a/dwarf-extract-struct.c
+++ b/dwarf-extract-struct.c
@@ -14,8 +14,8 @@
#include <stdio.h>
#include <strings.h>
#include <errno.h>
-#include "dwarf.h"
-#include "libdwarf.h"
+#include "libdwarf/dwarf.h"
+#include "libdwarf/libdwarf.h"
static void parse_dwarf(Dwarf_Debug dbg, const char *struct_name, const char *field_names[], int field_count);
@@ -25,15 +25,15 @@ static void print_field(Dwarf_Debug dbg, Dwarf_Die die, const char *field_name,
int debug = 0;
-void usage(char *argv[]) {
+void usage(const char *argv[]) {
printf("%s debug_file struct_name field [field...]\n", argv[0]);
}
-int main(int argc, char *argv[]) {
+int main(int argc, const char *argv[]) {
Dwarf_Debug dbg = 0;
int fd = -1;
const char *filepath;
- const char *struct_name, **field_names;
+ const char *struct_name;
int res = DW_DLV_ERROR;
Dwarf_Error error;
Dwarf_Handler errhand = 0;
@@ -46,19 +46,18 @@ int main(int argc, char *argv[]) {
filepath = argv[1];
struct_name = argv[2];
- field_names = argv + 3;
fd = open(filepath,O_RDONLY);
if(fd < 0) {
printf("Failure attempting to open %s\n",filepath);
}
- res = dwarf_init(fd,DW_DLC_READ,errhand,errarg, &dbg,&error);
+ res = dwarf_init(fd, DW_DLC_READ, errhand, errarg, &dbg, &error);
if(res != DW_DLV_OK) {
printf("Giving up, cannot do DWARF processing\n");
exit(1);
}
- parse_dwarf(dbg, struct_name, field_names, argc - 3);
+ parse_dwarf(dbg, struct_name, argv + 3, argc - 3);
res = dwarf_finish(dbg,&error);
if(res != DW_DLV_OK) {