Rev 4137 | Rev 4215 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4137 | Rev 4207 | ||
---|---|---|---|
Line 104... | Line 104... | ||
104 | * @param startpos - starting position, changes to found position |
104 | * @param startpos - starting position, changes to found position |
105 | * @return Pointer to the part of string that should be completed or NULL |
105 | * @return Pointer to the part of string that should be completed or NULL |
106 | */ |
106 | */ |
107 | static char * symtab_search_one(const char *name, int *startpos) |
107 | static char * symtab_search_one(const char *name, int *startpos) |
108 | { |
108 | { |
109 | unsigned int namelen = strlen(name); |
109 | unsigned int namelen = str_size(name); |
110 | char *curname; |
110 | char *curname; |
111 | int i, j; |
111 | int i, j; |
112 | int colonoffset = -1; |
112 | int colonoffset = -1; |
113 | 113 | ||
114 | for (i = 0; name[i]; i++) |
114 | for (i = 0; name[i]; i++) |
Line 124... | Line 124... | ||
124 | ; |
124 | ; |
125 | if (!curname[j]) |
125 | if (!curname[j]) |
126 | continue; |
126 | continue; |
127 | j -= colonoffset; |
127 | j -= colonoffset; |
128 | curname += j; |
128 | curname += j; |
129 | if (strlen(curname) < namelen) |
129 | if (str_size(curname) < namelen) |
130 | continue; |
130 | continue; |
131 | if (strncmp(curname, name, namelen) == 0) { |
131 | if (strncmp(curname, name, namelen) == 0) { |
132 | *startpos = i; |
132 | *startpos = i; |
133 | return curname + namelen; |
133 | return curname + namelen; |
134 | } |
134 | } |
Line 155... | Line 155... | ||
155 | char *hint; |
155 | char *hint; |
156 | int i; |
156 | int i; |
157 | 157 | ||
158 | i = 0; |
158 | i = 0; |
159 | while ((hint = symtab_search_one(name, &i))) { |
159 | while ((hint = symtab_search_one(name, &i))) { |
160 | if (!strlen(hint)) { |
160 | if (!str_size(hint)) { |
161 | *addr = uint64_t_le2host(symbol_table[i].address_le); |
161 | *addr = uint64_t_le2host(symbol_table[i].address_le); |
162 | found++; |
162 | found++; |
163 | } |
163 | } |
164 | i++; |
164 | i++; |
165 | } |
165 | } |
Line 212... | Line 212... | ||
212 | /* Allow completion of pointers */ |
212 | /* Allow completion of pointers */ |
213 | if (name[0] == '*' || name[0] == '&') |
213 | if (name[0] == '*' || name[0] == '&') |
214 | name++; |
214 | name++; |
215 | 215 | ||
216 | /* Do not print everything */ |
216 | /* Do not print everything */ |
217 | if (!strlen(name)) |
217 | if (!str_size(name)) |
218 | return 0; |
218 | return 0; |
219 | 219 | ||
220 | 220 | ||
221 | output[0] = '\0'; |
221 | output[0] = '\0'; |
222 | 222 | ||
223 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
223 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
224 | startpos++; |
224 | startpos++; |
225 | if (!found) |
225 | if (!found) |
226 | strncpy(output, foundtxt, strlen(foundtxt) + 1); |
226 | strncpy(output, foundtxt, str_size(foundtxt) + 1); |
227 | else { |
227 | else { |
228 | for (i = 0; output[i] && foundtxt[i] && |
228 | for (i = 0; output[i] && foundtxt[i] && |
229 | output[i] == foundtxt[i]; i++) |
229 | output[i] == foundtxt[i]; i++) |
230 | ; |
230 | ; |
231 | output[i] = '\0'; |
231 | output[i] = '\0'; |
Line 233... | Line 233... | ||
233 | found++; |
233 | found++; |
234 | } |
234 | } |
235 | if (!found) |
235 | if (!found) |
236 | return 0; |
236 | return 0; |
237 | 237 | ||
238 | if (found > 1 && !strlen(output)) { |
238 | if (found > 1 && !str_size(output)) { |
239 | printf("\n"); |
239 | printf("\n"); |
240 | startpos = 0; |
240 | startpos = 0; |
241 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
241 | while ((foundtxt = symtab_search_one(name, &startpos))) { |
242 | printf("%s\n", symbol_table[startpos].symbol_name); |
242 | printf("%s\n", symbol_table[startpos].symbol_name); |
243 | startpos++; |
243 | startpos++; |