Rev 1708 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1708 | Rev 1780 | ||
---|---|---|---|
Line 429... | Line 429... | ||
429 | break; |
429 | break; |
430 | (void) cmd_info->func(cmd_info->argv); |
430 | (void) cmd_info->func(cmd_info->argv); |
431 | } |
431 | } |
432 | } |
432 | } |
433 | 433 | ||
434 | static int parse_int_arg(char *text, size_t len, __native *result) |
434 | static int parse_int_arg(char *text, size_t len, unative_t *result) |
435 | { |
435 | { |
436 | char symname[MAX_SYMBOL_NAME]; |
436 | char symname[MAX_SYMBOL_NAME]; |
437 | __address symaddr; |
437 | uintptr_t symaddr; |
438 | bool isaddr = false; |
438 | bool isaddr = false; |
439 | bool isptr = false; |
439 | bool isptr = false; |
440 | 440 | ||
441 | /* If we get a name, try to find it in symbol table */ |
441 | /* If we get a name, try to find it in symbol table */ |
442 | if (text[0] == '&') { |
442 | if (text[0] == '&') { |
Line 451... | Line 451... | ||
451 | symaddr = get_symbol_addr(symname); |
451 | symaddr = get_symbol_addr(symname); |
452 | if (!symaddr) { |
452 | if (!symaddr) { |
453 | printf("Symbol %s not found.\n",symname); |
453 | printf("Symbol %s not found.\n",symname); |
454 | return -1; |
454 | return -1; |
455 | } |
455 | } |
456 | if (symaddr == (__address) -1) { |
456 | if (symaddr == (uintptr_t) -1) { |
457 | printf("Duplicate symbol %s.\n",symname); |
457 | printf("Duplicate symbol %s.\n",symname); |
458 | symtab_print_search(symname); |
458 | symtab_print_search(symname); |
459 | return -1; |
459 | return -1; |
460 | } |
460 | } |
461 | if (isaddr) |
461 | if (isaddr) |
462 | *result = (__native)symaddr; |
462 | *result = (unative_t)symaddr; |
463 | else if (isptr) |
463 | else if (isptr) |
464 | *result = **((__native **)symaddr); |
464 | *result = **((unative_t **)symaddr); |
465 | else |
465 | else |
466 | *result = *((__native *)symaddr); |
466 | *result = *((unative_t *)symaddr); |
467 | } else { /* It's a number - convert it */ |
467 | } else { /* It's a number - convert it */ |
468 | *result = atoi(text); |
468 | *result = atoi(text); |
469 | if (isptr) |
469 | if (isptr) |
470 | *result = *((__native *)*result); |
470 | *result = *((unative_t *)*result); |
471 | } |
471 | } |
472 | 472 | ||
473 | return 0; |
473 | return 0; |
474 | } |
474 | } |
475 | 475 | ||
Line 552... | Line 552... | ||
552 | if (start != end && cmdline[start] == '"' && cmdline[end] == '"') { |
552 | if (start != end && cmdline[start] == '"' && cmdline[end] == '"') { |
553 | buf = cmd->argv[i].buffer; |
553 | buf = cmd->argv[i].buffer; |
554 | strncpy(buf, (const char *) &cmdline[start+1], |
554 | strncpy(buf, (const char *) &cmdline[start+1], |
555 | min((end-start), cmd->argv[i].len)); |
555 | min((end-start), cmd->argv[i].len)); |
556 | buf[min((end - start), cmd->argv[i].len - 1)] = '\0'; |
556 | buf[min((end - start), cmd->argv[i].len - 1)] = '\0'; |
557 | cmd->argv[i].intval = (__native) buf; |
557 | cmd->argv[i].intval = (unative_t) buf; |
558 | cmd->argv[i].vartype = ARG_TYPE_STRING; |
558 | cmd->argv[i].vartype = ARG_TYPE_STRING; |
559 | } else if (!parse_int_arg(cmdline+start, end-start+1, |
559 | } else if (!parse_int_arg(cmdline+start, end-start+1, |
560 | &cmd->argv[i].intval)) |
560 | &cmd->argv[i].intval)) |
561 | cmd->argv[i].vartype = ARG_TYPE_INT; |
561 | cmd->argv[i].vartype = ARG_TYPE_INT; |
562 | else { |
562 | else { |