1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2013 Intel Corporation; author: Matt Fleming
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8  *   Boston MA 02110-1301, USA; either version 2 of the License, or
9  *   (at your option) any later version; incorporated herein by reference.
10  *
11  * ----------------------------------------------------------------------- */
12 
13 #include <syslinux/debug.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 
18 static char *progname;
19 
20 static void usage(void)
21 {
22     fprintf(stderr, "Usage: %s [-e|-d] <func1> [<func2>, ...]\n", progname);
23 }
24 
25 int main(int argc, char *argv[])
26 {
27     bool enable;
28     int i;
29 
30     progname = argv[0];
31 
32     if (argc < 3) {
33 	usage();
34 	return -1;
35     }
36 
37     if (!strncmp(argv[1], "-e", 2))
38 	enable = true;
39     else if (!strncmp(argv[1], "-d", 2))
40 	enable = false;
41     else {
42 	usage();
43 	return -1;
44     }
45 
46     for (i = 2; i < argc; i++) {
47 	char *str = argv[i];
48 
49 	if (syslinux_debug(str, enable) < 0)
50 	    fprintf(stderr, "Failed to debug symbol \"%s\"\n", str);
51     }
52 
53     return 0;
54 }
55