OpenCores
URL https://opencores.org/ocsvn/core_arm/core_arm/trunk

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [soft/] [sim/] [args.c] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
 
2
#include "sim.h"
3
 
4
char *program_name = "sim";
5
#define REPORT_BUGS_TO "Konrad Eisele <eiselekd@web.de>"
6
static void print_version(char *n) {
7
  printf(n);
8
}
9
 
10
struct option options[] =
11
{
12
  {"all",              no_argument, 0, 'a'},
13
  {"file-header",      no_argument, 0, 'h'},
14
  {"program-headers",  no_argument, 0, 'l'},
15
  {"headers",          no_argument, 0, 'e'},
16
  {"histogram",        no_argument, 0, 'I'},
17
  {"segments",         no_argument, 0, 'l'},
18
  {"sections",         no_argument, 0, 'S'},
19
  {"section-headers",  no_argument, 0, 'S'},
20
  {"symbols",          no_argument, 0, 's'},
21
  {"syms",             no_argument, 0, 's'},
22
  {"relocs",           no_argument, 0, 'r'},
23
  {"notes",            no_argument, 0, 'n'},
24
  {"dynamic",          no_argument, 0, 'd'},
25
  {"arch-specific",    no_argument, 0, 'A'},
26
  {"version-info",     no_argument, 0, 'V'},
27
  {"use-dynamic",      no_argument, 0, 'D'},
28
  {"hex-dump",         required_argument, 0, 'x'},
29
  {"unwind",           no_argument, 0, 'u'},
30
#ifdef SUPPORT_DISASSEMBLY
31
  {"instruction-dump", required_argument, 0, 'i'},
32
#endif
33
 
34
  {"version",          no_argument, 0, 'v'},
35
  {"wide",             no_argument, 0, 'W'},
36
  {"help",             no_argument, 0, 'H'},
37
  {0,                   no_argument, 0, 0}
38
};
39
 
40
static void
41
usage ()
42
{
43
  fprintf (stdout, "Usage: readelf <option(s)> elf-file(s)\n");
44
  fprintf (stdout, " Display information about the contents of ELF format files\n");
45
  fprintf (stdout, " Options are:\n\
46
  -a --all               Equivalent to: -h -l -S -s -r -d -V -A -I\n\
47
  -h --file-header       Display the ELF file header\n\
48
  -l --program-headers   Display the program headers\n\
49
     --segments          An alias for --program-headers\n\
50
  -S --section-headers   Display the sections' header\n\
51
     --sections          An alias for --section-headers\n\
52
  -e --headers           Equivalent to: -h -l -S\n\
53
  -s --syms              Display the symbol table\n\
54
      --symbols          An alias for --syms\n\
55
  -n --notes             Display the core notes (if present)\n\
56
  -r --relocs            Display the relocations (if present)\n\
57
  -u --unwind            Display the unwind info (if present)\n\
58
  -d --dynamic           Display the dynamic segment (if present)\n\
59
  -V --version-info      Display the version sections (if present)\n\
60
  -A --arch-specific     Display architecture specific information (if any).\n\
61
  -D --use-dynamic       Use the dynamic section info when displaying symbols\n\
62
  -x --hex-dump=<number> Dump the contents of section <number>\n\
63
  -w[liaprmfFso] or\n\
64
  --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames,=str,=loc]\n\
65
                         Display the contents of DWARF2 debug sections\n");
66
#ifdef SUPPORT_DISASSEMBLY
67
  fprintf (stdout, "\
68
  -i --instruction-dump=<number>\n\
69
                         Disassemble the contents of section <number>\n");
70
#endif
71
  fprintf (stdout, "\
72
  -I --histogram         Display histogram of bucket list lengths\n\
73
  -W --wide              Allow output width to exceed 80 characters\n\
74
  -H --help              Display this information\n\
75
  -v --version           Display the version number of readelf\n");
76
  fprintf (stdout, "Report bugs to %s\n", REPORT_BUGS_TO);
77
 
78
  exit (0);
79
}
80
 
81
void
82
parse_args (argc, argv)
83
     int argc;
84
     char **argv;
85
{
86
  int c;
87
 
88
  if (argc < 2)
89
    usage ();
90
 
91
  while ((c = getopt_long
92
          (argc, argv, "ersuahnldSDAIw::x:i:vVWH", options, NULL)) != EOF)
93
    {
94
      char *cp;
95
      int section;
96
 
97
      switch (c)
98
        {
99
        case 0:
100
          /* Long options.  */
101
          break;
102
        case 'H':
103
          usage ();
104
          break;
105
 
106
        case 'a':
107
          break;
108
        case 'e':
109
          break;
110
        case 'A':
111
          break;
112
        case 'D':
113
          break;
114
        case 'r':
115
          break;
116
        case 'u':
117
          break;
118
        case 'h':
119
          break;
120
        case 'l':
121
          break;
122
        case 's':
123
          break;
124
        case 'd':
125
          break;
126
        case 'I':
127
          break;
128
        case 'n':
129
          break;
130
        case 'x':
131
          goto oops;
132
        case 'w':
133
          break;
134
#ifdef SUPPORT_DISASSEMBLY
135
        case 'i':
136
          goto oops;
137
#endif
138
        case 'v':
139
          print_version (program_name);
140
          break;
141
        case 'V':
142
          break;
143
        case 'W':
144
          break;
145
        default:
146
        oops:
147
          /* xgettext:c-format */
148
          //error ("Invalid option '-%c'\n", c);
149
          /* Drop through.  */
150
        case '?':
151
          usage ();
152
        }
153
    }
154
 
155
    usage ();
156
}
157
 
158
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.