Rev 585 | Rev 591 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 585 | Rev 589 | ||
|---|---|---|---|
| Line 322... | Line 322... | ||
| 322 | static int parse_int_arg(char *text, size_t len, __native *result) |
322 | static int parse_int_arg(char *text, size_t len, __native *result) |
| 323 | { |
323 | { |
| 324 | char symname[MAX_SYMBOL_NAME]; |
324 | char symname[MAX_SYMBOL_NAME]; |
| 325 | __address symaddr; |
325 | __address symaddr; |
| 326 | bool isaddr = false; |
326 | bool isaddr = false; |
| - | 327 | bool isptr = false; |
|
| 327 | 328 | ||
| 328 | /* If we get a name, try to find it in symbol table */ |
329 | /* If we get a name, try to find it in symbol table */ |
| 329 | if (text[0] < '0' | text[0] > '9') { |
330 | if (text[0] < '0' | text[0] > '9') { |
| 330 | if (text[0] == '&') { |
331 | if (text[0] == '&') { |
| 331 | isaddr = true; |
332 | isaddr = true; |
| 332 | text++;len--; |
333 | text++;len--; |
| - | 334 | } else if (text[0] == '*') { |
|
| - | 335 | isptr = true; |
|
| - | 336 | text++;len--; |
|
| 333 | } |
337 | } |
| 334 | strncpy(symname, text, min(len+1, MAX_SYMBOL_NAME)); |
338 | strncpy(symname, text, min(len+1, MAX_SYMBOL_NAME)); |
| 335 | symaddr = get_symbol_addr(symname); |
339 | symaddr = get_symbol_addr(symname); |
| 336 | if (!symaddr) { |
340 | if (!symaddr) { |
| 337 | printf("Symbol %s not found.\n",symname); |
341 | printf("Symbol %s not found.\n",symname); |
| Line 342... | Line 346... | ||
| 342 | symtab_print_search(symname); |
346 | symtab_print_search(symname); |
| 343 | return -1; |
347 | return -1; |
| 344 | } |
348 | } |
| 345 | if (isaddr) |
349 | if (isaddr) |
| 346 | *result = (__native)symaddr; |
350 | *result = (__native)symaddr; |
| - | 351 | else if (isptr) |
|
| - | 352 | *result = **((__native **)symaddr); |
|
| 347 | else |
353 | else |
| 348 | *result = *((__native *)symaddr); |
354 | *result = *((__native *)symaddr); |
| 349 | } else /* It's a number - convert it */ |
355 | } else /* It's a number - convert it */ |
| 350 | *result = atoi(text); |
356 | *result = atoi(text); |
| 351 | return 0; |
357 | return 0; |