Rev 2935 | Rev 2937 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2935 | Rev 2936 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | #include <bool.h> |
38 | #include <bool.h> |
39 | #include <udebug.h> |
39 | #include <udebug.h> |
40 | #include <sys/types.h> |
40 | #include <sys/types.h> |
41 | 41 | ||
42 | #include "main.h" |
42 | #include "main.h" |
- | 43 | #include "cons.h" |
|
43 | #include "include/arch.h" |
44 | #include "include/arch.h" |
44 | #include "cmd.h" |
45 | #include "cmd.h" |
45 | 46 | ||
46 | static void cmd_break(int argc, char *argv[]); |
47 | static void cmd_break(int argc, char *argv[]); |
47 | void cmd_go(int argc, char *argv[]); |
48 | void cmd_go(int argc, char *argv[]); |
Line 65... | Line 66... | ||
65 | uintptr_t addr; |
66 | uintptr_t addr; |
66 | 67 | ||
67 | (void)argc; |
68 | (void)argc; |
68 | addr = strtoul(argv[1], NULL, 0); |
69 | addr = strtoul(argv[1], NULL, 0); |
69 | 70 | ||
70 | printf("You requested a breakpoint at 0x%x\n", addr); |
71 | cons_printf("You requested a breakpoint at 0x%x\n", addr); |
71 | arch_breakpoint_add(addr); |
72 | arch_breakpoint_add(addr); |
72 | } |
73 | } |
73 | 74 | ||
74 | void cmd_go(int argc, char *argv[]) |
75 | void cmd_go(int argc, char *argv[]) |
75 | { |
76 | { |
Line 81... | Line 82... | ||
81 | int i; |
82 | int i; |
82 | 83 | ||
83 | (void)argc; (void)argv; |
84 | (void)argc; (void)argv; |
84 | i = 0; |
85 | i = 0; |
85 | while (cmd_table[i].name != NULL) { |
86 | while (cmd_table[i].name != NULL) { |
86 | printf("%s\n", cmd_table[i].name); |
87 | cons_printf("%s\n", cmd_table[i].name); |
87 | ++i; |
88 | ++i; |
88 | } |
89 | } |
89 | } |
90 | } |
90 | 91 | ||
91 | #define BYTES_PER_LINE 16 |
92 | #define BYTES_PER_LINE 16 |
Line 105... | Line 106... | ||
105 | while (length > 0) { |
106 | while (length > 0) { |
106 | to_read = length < BYTES_PER_LINE ? length : BYTES_PER_LINE; |
107 | to_read = length < BYTES_PER_LINE ? length : BYTES_PER_LINE; |
107 | 108 | ||
108 | rc = udebug_mem_read(app_phone, buf, addr, to_read); |
109 | rc = udebug_mem_read(app_phone, buf, addr, to_read); |
109 | if (rc < 0) { |
110 | if (rc < 0) { |
110 | printf("error %d\n", rc); |
111 | cons_printf("error %d\n", rc); |
111 | return; |
112 | return; |
112 | } |
113 | } |
113 | 114 | ||
114 | printf("0x%x:", addr); |
115 | cons_printf("0x%x:", addr); |
115 | for (i = 0; i < to_read; ++i) { |
116 | for (i = 0; i < to_read; ++i) { |
116 | printf(" %02x", buf[i]); |
117 | cons_printf(" %02x", buf[i]); |
117 | } |
118 | } |
118 | for (i = to_read; i < BYTES_PER_LINE; ++i) { |
119 | for (i = to_read; i < BYTES_PER_LINE; ++i) { |
119 | printf(" "); |
120 | cons_printf(" "); |
120 | } |
121 | } |
121 | 122 | ||
122 | putchar ('\t'); |
123 | putchar ('\t'); |
123 | 124 | ||
124 | for (i = 0; i < to_read; ++i) { |
125 | for (i = 0; i < to_read; ++i) { |
125 | if (buf[i] >= 32 && buf[i] < 127) |
126 | if (buf[i] >= 32 && buf[i] < 127) |
126 | putchar(buf[i]); |
127 | putchar(buf[i]); |
127 | else |
128 | else |
128 | putchar('.'); |
129 | putchar('.'); |
129 | } |
130 | } |
130 | printf("\n"); |
131 | cons_printf("\n"); |
131 | 132 | ||
132 | addr += to_read; |
133 | addr += to_read; |
133 | length -= to_read; |
134 | length -= to_read; |
134 | } |
135 | } |
135 | } |
136 | } |