Rev 788 | Rev 932 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 788 | Rev 931 | ||
|---|---|---|---|
| Line 426... | Line 426... | ||
| 426 | __address symaddr; |
426 | __address symaddr; |
| 427 | bool isaddr = false; |
427 | bool isaddr = false; |
| 428 | bool isptr = false; |
428 | bool isptr = false; |
| 429 | 429 | ||
| 430 | /* If we get a name, try to find it in symbol table */ |
430 | /* If we get a name, try to find it in symbol table */ |
| - | 431 | if (text[0] == '&') { |
|
| - | 432 | isaddr = true; |
|
| - | 433 | text++;len--; |
|
| - | 434 | } else if (text[0] == '*') { |
|
| - | 435 | isptr = true; |
|
| - | 436 | text++;len--; |
|
| - | 437 | } |
|
| 431 | if (text[0] < '0' || text[0] > '9') { |
438 | if (text[0] < '0' || text[0] > '9') { |
| 432 | if (text[0] == '&') { |
- | |
| 433 | isaddr = true; |
- | |
| 434 | text++;len--; |
- | |
| 435 | } else if (text[0] == '*') { |
- | |
| 436 | isptr = true; |
- | |
| 437 | text++;len--; |
- | |
| 438 | } |
- | |
| 439 | strncpy(symname, text, min(len+1, MAX_SYMBOL_NAME)); |
439 | strncpy(symname, text, min(len+1, MAX_SYMBOL_NAME)); |
| 440 | symaddr = get_symbol_addr(symname); |
440 | symaddr = get_symbol_addr(symname); |
| 441 | if (!symaddr) { |
441 | if (!symaddr) { |
| 442 | printf("Symbol %s not found.\n",symname); |
442 | printf("Symbol %s not found.\n",symname); |
| 443 | return -1; |
443 | return -1; |
| Line 445... | Line 445... | ||
| 445 | if (symaddr == (__address) -1) { |
445 | if (symaddr == (__address) -1) { |
| 446 | printf("Duplicate symbol %s.\n",symname); |
446 | printf("Duplicate symbol %s.\n",symname); |
| 447 | symtab_print_search(symname); |
447 | symtab_print_search(symname); |
| 448 | return -1; |
448 | return -1; |
| 449 | } |
449 | } |
| 450 | if (isaddr) |
- | |
| 451 | *result = (__native)symaddr; |
- | |
| 452 | else if (isptr) |
- | |
| 453 | *result = **((__native **)symaddr); |
- | |
| 454 | else |
- | |
| 455 | *result = *((__native *)symaddr); |
- | |
| 456 | } else /* It's a number - convert it */ |
450 | } else /* It's a number - convert it */ |
| 457 | *result = atoi(text); |
451 | *result = atoi(text); |
| - | 452 | ||
| - | 453 | if (isaddr) |
|
| - | 454 | *result = (__native)symaddr; |
|
| - | 455 | else if (isptr) |
|
| - | 456 | *result = **((__native **)symaddr); |
|
| - | 457 | else |
|
| - | 458 | *result = *((__native *)symaddr); |
|
| - | 459 | ||
| 458 | return 0; |
460 | return 0; |
| 459 | } |
461 | } |
| 460 | 462 | ||
| 461 | /** Parse command line. |
463 | /** Parse command line. |
| 462 | * |
464 | * |