Rev 2089 | Rev 2223 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2089 | Rev 2114 | ||
---|---|---|---|
Line 523... | Line 523... | ||
523 | } |
523 | } |
524 | 524 | ||
525 | /** Search symbol table */ |
525 | /** Search symbol table */ |
526 | int cmd_symaddr(cmd_arg_t *argv) |
526 | int cmd_symaddr(cmd_arg_t *argv) |
527 | { |
527 | { |
528 | symtab_print_search(argv->buffer); |
528 | symtab_print_search((char *) argv->buffer); |
529 | 529 | ||
530 | return 1; |
530 | return 1; |
531 | } |
531 | } |
532 | 532 | ||
533 | /** Call function with zero parameters */ |
533 | /** Call function with zero parameters */ |
Line 541... | Line 541... | ||
541 | unative_t f; |
541 | unative_t f; |
542 | unative_t gp; |
542 | unative_t gp; |
543 | }fptr; |
543 | }fptr; |
544 | #endif |
544 | #endif |
545 | 545 | ||
546 | symaddr = get_symbol_addr(argv->buffer); |
546 | symaddr = get_symbol_addr((char *) argv->buffer); |
547 | if (!symaddr) |
547 | if (!symaddr) |
548 | printf("Symbol %s not found.\n", argv->buffer); |
548 | printf("Symbol %s not found.\n", argv->buffer); |
549 | else if (symaddr == (uintptr_t) -1) { |
549 | else if (symaddr == (uintptr_t) -1) { |
550 | symtab_print_search(argv->buffer); |
550 | symtab_print_search((char *) argv->buffer); |
551 | printf("Duplicate symbol, be more specific.\n"); |
551 | printf("Duplicate symbol, be more specific.\n"); |
552 | } else { |
552 | } else { |
553 | symbol = get_symtab_entry(symaddr); |
553 | symbol = get_symtab_entry(symaddr); |
554 | printf("Calling f(): %.*p: %s\n", sizeof(uintptr_t) * 2, symaddr, symbol); |
554 | printf("Calling f(): %.*p: %s\n", sizeof(uintptr_t) * 2, symaddr, symbol); |
555 | #ifdef ia64 |
555 | #ifdef ia64 |
Line 577... | Line 577... | ||
577 | unative_t f; |
577 | unative_t f; |
578 | unative_t gp; |
578 | unative_t gp; |
579 | }fptr; |
579 | }fptr; |
580 | #endif |
580 | #endif |
581 | 581 | ||
582 | symaddr = get_symbol_addr(argv->buffer); |
582 | symaddr = get_symbol_addr((char *) argv->buffer); |
583 | if (!symaddr) |
583 | if (!symaddr) |
584 | printf("Symbol %s not found.\n", argv->buffer); |
584 | printf("Symbol %s not found.\n", argv->buffer); |
585 | else if (symaddr == (uintptr_t) -1) { |
585 | else if (symaddr == (uintptr_t) -1) { |
586 | symtab_print_search(argv->buffer); |
586 | symtab_print_search((char *) argv->buffer); |
587 | printf("Duplicate symbol, be more specific.\n"); |
587 | printf("Duplicate symbol, be more specific.\n"); |
588 | } else { |
588 | } else { |
589 | symbol = get_symtab_entry(symaddr); |
589 | symbol = get_symtab_entry(symaddr); |
590 | 590 | ||
591 | printf("Calling f(%#zx): %.*p: %s\n", arg1, sizeof(uintptr_t) * 2, symaddr, symbol); |
591 | printf("Calling f(%#zx): %.*p: %s\n", arg1, sizeof(uintptr_t) * 2, symaddr, symbol); |
Line 615... | Line 615... | ||
615 | unative_t f; |
615 | unative_t f; |
616 | unative_t gp; |
616 | unative_t gp; |
617 | }fptr; |
617 | }fptr; |
618 | #endif |
618 | #endif |
619 | 619 | ||
620 | symaddr = get_symbol_addr(argv->buffer); |
620 | symaddr = get_symbol_addr((char *) argv->buffer); |
621 | if (!symaddr) |
621 | if (!symaddr) |
622 | printf("Symbol %s not found.\n", argv->buffer); |
622 | printf("Symbol %s not found.\n", argv->buffer); |
623 | else if (symaddr == (uintptr_t) -1) { |
623 | else if (symaddr == (uintptr_t) -1) { |
624 | symtab_print_search(argv->buffer); |
624 | symtab_print_search((char *) argv->buffer); |
625 | printf("Duplicate symbol, be more specific.\n"); |
625 | printf("Duplicate symbol, be more specific.\n"); |
626 | } else { |
626 | } else { |
627 | symbol = get_symtab_entry(symaddr); |
627 | symbol = get_symtab_entry(symaddr); |
628 | printf("Calling f(0x%zx,0x%zx): %.*p: %s\n", |
628 | printf("Calling f(0x%zx,0x%zx): %.*p: %s\n", |
629 | arg1, arg2, sizeof(uintptr_t) * 2, symaddr, symbol); |
629 | arg1, arg2, sizeof(uintptr_t) * 2, symaddr, symbol); |
Line 654... | Line 654... | ||
654 | unative_t f; |
654 | unative_t f; |
655 | unative_t gp; |
655 | unative_t gp; |
656 | }fptr; |
656 | }fptr; |
657 | #endif |
657 | #endif |
658 | 658 | ||
659 | symaddr = get_symbol_addr(argv->buffer); |
659 | symaddr = get_symbol_addr((char *) argv->buffer); |
660 | if (!symaddr) |
660 | if (!symaddr) |
661 | printf("Symbol %s not found.\n", argv->buffer); |
661 | printf("Symbol %s not found.\n", argv->buffer); |
662 | else if (symaddr == (uintptr_t) -1) { |
662 | else if (symaddr == (uintptr_t) -1) { |
663 | symtab_print_search(argv->buffer); |
663 | symtab_print_search((char *) argv->buffer); |
664 | printf("Duplicate symbol, be more specific.\n"); |
664 | printf("Duplicate symbol, be more specific.\n"); |
665 | } else { |
665 | } else { |
666 | symbol = get_symtab_entry(symaddr); |
666 | symbol = get_symtab_entry(symaddr); |
667 | printf("Calling f(0x%zx,0x%zx, 0x%zx): %.*p: %s\n", |
667 | printf("Calling f(0x%zx,0x%zx, 0x%zx): %.*p: %s\n", |
668 | arg1, arg2, arg3, sizeof(uintptr_t) * 2, symaddr, symbol); |
668 | arg1, arg2, arg3, sizeof(uintptr_t) * 2, symaddr, symbol); |
Line 716... | Line 716... | ||
716 | uint32_t *addr ; |
716 | uint32_t *addr ; |
717 | uint32_t arg1 = argv[1].intval; |
717 | uint32_t arg1 = argv[1].intval; |
718 | bool pointer = false; |
718 | bool pointer = false; |
719 | 719 | ||
720 | if (((char *)argv->buffer)[0] == '*') { |
720 | if (((char *)argv->buffer)[0] == '*') { |
721 | addr = (uint32_t *) get_symbol_addr(argv->buffer+1); |
721 | addr = (uint32_t *) get_symbol_addr((char *) argv->buffer + 1); |
722 | pointer = true; |
722 | pointer = true; |
723 | } else if (((char *)argv->buffer)[0] >= '0' && |
723 | } else if (((char *) argv->buffer)[0] >= '0' && |
724 | ((char *)argv->buffer)[0] <= '9') |
724 | ((char *)argv->buffer)[0] <= '9') |
725 | addr = (uint32_t *)atoi((char *)argv->buffer); |
725 | addr = (uint32_t *)atoi((char *)argv->buffer); |
726 | else |
726 | else |
727 | addr = (uint32_t *)get_symbol_addr(argv->buffer); |
727 | addr = (uint32_t *)get_symbol_addr((char *) argv->buffer); |
728 | 728 | ||
729 | if (!addr) |
729 | if (!addr) |
730 | printf("Symbol %s not found.\n", argv->buffer); |
730 | printf("Symbol %s not found.\n", argv->buffer); |
731 | else if (addr == (uint32_t *) -1) { |
731 | else if (addr == (uint32_t *) -1) { |
732 | symtab_print_search(argv->buffer); |
732 | symtab_print_search((char *) argv->buffer); |
733 | printf("Duplicate symbol, be more specific.\n"); |
733 | printf("Duplicate symbol, be more specific.\n"); |
734 | } else { |
734 | } else { |
735 | if (pointer) |
735 | if (pointer) |
736 | addr = (uint32_t *)(*(unative_t *)addr); |
736 | addr = (uint32_t *)(*(unative_t *)addr); |
737 | printf("Writing 0x%x -> %.*p\n", arg1, sizeof(uintptr_t) * 2, addr); |
737 | printf("Writing 0x%x -> %.*p\n", arg1, sizeof(uintptr_t) * 2, addr); |
Line 922... | Line 922... | ||
922 | char suffix; |
922 | char suffix; |
923 | 923 | ||
924 | if (cnt < 1) |
924 | if (cnt < 1) |
925 | return true; |
925 | return true; |
926 | 926 | ||
927 | uint64_t *data = malloc(sizeof(uint64_t) * cnt, 0); |
927 | uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt, 0); |
928 | if (data == NULL) { |
928 | if (data == NULL) { |
929 | printf("Error allocating memory for statistics\n"); |
929 | printf("Error allocating memory for statistics\n"); |
930 | return false; |
930 | return false; |
931 | } |
931 | } |
932 | 932 | ||
Line 988... | Line 988... | ||
988 | */ |
988 | */ |
989 | int cmd_test(cmd_arg_t *argv) |
989 | int cmd_test(cmd_arg_t *argv) |
990 | { |
990 | { |
991 | test_t *test; |
991 | test_t *test; |
992 | 992 | ||
993 | if (strcmp(argv->buffer, "*") == 0) { |
993 | if (strcmp((char *) argv->buffer, "*") == 0) { |
994 | for (test = tests; test->name != NULL; test++) { |
994 | for (test = tests; test->name != NULL; test++) { |
995 | if (test->safe) { |
995 | if (test->safe) { |
996 | printf("\n"); |
996 | printf("\n"); |
997 | if (!run_test(test)) |
997 | if (!run_test(test)) |
998 | break; |
998 | break; |
Line 1000... | Line 1000... | ||
1000 | } |
1000 | } |
1001 | } else { |
1001 | } else { |
1002 | bool fnd = false; |
1002 | bool fnd = false; |
1003 | 1003 | ||
1004 | for (test = tests; test->name != NULL; test++) { |
1004 | for (test = tests; test->name != NULL; test++) { |
1005 | if (strcmp(test->name, argv->buffer) == 0) { |
1005 | if (strcmp(test->name, (char *) argv->buffer) == 0) { |
1006 | fnd = true; |
1006 | fnd = true; |
1007 | run_test(test); |
1007 | run_test(test); |
1008 | break; |
1008 | break; |
1009 | } |
1009 | } |
1010 | } |
1010 | } |
Line 1028... | Line 1028... | ||
1028 | uint32_t cnt = argv[1].intval; |
1028 | uint32_t cnt = argv[1].intval; |
1029 | 1029 | ||
1030 | bool fnd = false; |
1030 | bool fnd = false; |
1031 | 1031 | ||
1032 | for (test = tests; test->name != NULL; test++) { |
1032 | for (test = tests; test->name != NULL; test++) { |
1033 | if (strcmp(test->name, argv->buffer) == 0) { |
1033 | if (strcmp(test->name, (char *) argv->buffer) == 0) { |
1034 | fnd = true; |
1034 | fnd = true; |
1035 | 1035 | ||
1036 | if (test->safe) |
1036 | if (test->safe) |
1037 | run_bench(test, cnt); |
1037 | run_bench(test, cnt); |
1038 | else |
1038 | else |