diff options
Diffstat (limited to 'Documentation/perf_counter/util/symbol.c')
-rw-r--r-- | Documentation/perf_counter/util/symbol.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/Documentation/perf_counter/util/symbol.c b/Documentation/perf_counter/util/symbol.c index 47281210443d..31e8fae58426 100644 --- a/Documentation/perf_counter/util/symbol.c +++ b/Documentation/perf_counter/util/symbol.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "util.h" | 1 | #include "util.h" |
2 | #include "../perf.h" | 2 | #include "../perf.h" |
3 | #include "string.h" | ||
3 | #include "symbol.h" | 4 | #include "symbol.h" |
4 | 5 | ||
5 | #include <libelf.h> | 6 | #include <libelf.h> |
@@ -122,39 +123,6 @@ size_t dso__fprintf(struct dso *self, FILE *fp) | |||
122 | return ret; | 123 | return ret; |
123 | } | 124 | } |
124 | 125 | ||
125 | static int hex(char ch) | ||
126 | { | ||
127 | if ((ch >= '0') && (ch <= '9')) | ||
128 | return ch - '0'; | ||
129 | if ((ch >= 'a') && (ch <= 'f')) | ||
130 | return ch - 'a' + 10; | ||
131 | if ((ch >= 'A') && (ch <= 'F')) | ||
132 | return ch - 'A' + 10; | ||
133 | return -1; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | * While we find nice hex chars, build a long_val. | ||
138 | * Return number of chars processed. | ||
139 | */ | ||
140 | static int hex2long(char *ptr, unsigned long *long_val) | ||
141 | { | ||
142 | const char *p = ptr; | ||
143 | *long_val = 0; | ||
144 | |||
145 | while (*p) { | ||
146 | const int hex_val = hex(*p); | ||
147 | |||
148 | if (hex_val < 0) | ||
149 | break; | ||
150 | |||
151 | *long_val = (*long_val << 4) | hex_val; | ||
152 | p++; | ||
153 | } | ||
154 | |||
155 | return p - ptr; | ||
156 | } | ||
157 | |||
158 | static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) | 126 | static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) |
159 | { | 127 | { |
160 | struct rb_node *nd, *prevnd; | 128 | struct rb_node *nd, *prevnd; |
@@ -166,7 +134,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) | |||
166 | goto out_failure; | 134 | goto out_failure; |
167 | 135 | ||
168 | while (!feof(file)) { | 136 | while (!feof(file)) { |
169 | unsigned long start; | 137 | __u64 start; |
170 | struct symbol *sym; | 138 | struct symbol *sym; |
171 | int line_len, len; | 139 | int line_len, len; |
172 | char symbol_type; | 140 | char symbol_type; |
@@ -180,7 +148,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter) | |||
180 | 148 | ||
181 | line[--line_len] = '\0'; /* \n */ | 149 | line[--line_len] = '\0'; /* \n */ |
182 | 150 | ||
183 | len = hex2long(line, &start); | 151 | len = hex2u64(line, &start); |
184 | 152 | ||
185 | len++; | 153 | len++; |
186 | if (len + 2 >= line_len) | 154 | if (len + 2 >= line_len) |