Rev 1705 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1705 | Rev 1780 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | * |
48 | * |
49 | * @param addr Address. |
49 | * @param addr Address. |
50 | * |
50 | * |
51 | * @return Pointer to respective symbol string on success, NULL otherwise. |
51 | * @return Pointer to respective symbol string on success, NULL otherwise. |
52 | */ |
52 | */ |
53 | char * get_symtab_entry(__native addr) |
53 | char * get_symtab_entry(unative_t addr) |
54 | { |
54 | { |
55 | count_t i; |
55 | count_t i; |
56 | 56 | ||
57 | for (i=1;symbol_table[i].address_le;++i) { |
57 | for (i=1;symbol_table[i].address_le;++i) { |
58 | if (addr < __u64_le2host(symbol_table[i].address_le)) |
58 | if (addr < uint64_t_le2host(symbol_table[i].address_le)) |
59 | break; |
59 | break; |
60 | } |
60 | } |
61 | if (addr >= __u64_le2host(symbol_table[i-1].address_le)) |
61 | if (addr >= uint64_t_le2host(symbol_table[i-1].address_le)) |
62 | return symbol_table[i-1].symbol_name; |
62 | return symbol_table[i-1].symbol_name; |
63 | return NULL; |
63 | return NULL; |
64 | } |
64 | } |
65 | 65 | ||
66 | /** Find symbols that match the parameter forward and print them. |
66 | /** Find symbols that match the parameter forward and print them. |
Line 106... | Line 106... | ||
106 | * Search symbol table, and if there is one match, return it |
106 | * Search symbol table, and if there is one match, return it |
107 | * |
107 | * |
108 | * @param name Name of the symbol |
108 | * @param name Name of the symbol |
109 | * @return 0 - Not found, -1 - Duplicate symbol, other - address of symbol |
109 | * @return 0 - Not found, -1 - Duplicate symbol, other - address of symbol |
110 | */ |
110 | */ |
111 | __address get_symbol_addr(const char *name) |
111 | uintptr_t get_symbol_addr(const char *name) |
112 | { |
112 | { |
113 | count_t found = 0; |
113 | count_t found = 0; |
114 | __address addr = NULL; |
114 | uintptr_t addr = NULL; |
115 | char *hint; |
115 | char *hint; |
116 | int i; |
116 | int i; |
117 | 117 | ||
118 | i = 0; |
118 | i = 0; |
119 | while ((hint=symtab_search_one(name, &i))) { |
119 | while ((hint=symtab_search_one(name, &i))) { |
120 | if (!strlen(hint)) { |
120 | if (!strlen(hint)) { |
121 | addr = __u64_le2host(symbol_table[i].address_le); |
121 | addr = uint64_t_le2host(symbol_table[i].address_le); |
122 | found++; |
122 | found++; |
123 | } |
123 | } |
124 | i++; |
124 | i++; |
125 | } |
125 | } |
126 | if (found > 1) |
126 | if (found > 1) |
127 | return ((__address) -1); |
127 | return ((uintptr_t) -1); |
128 | return addr; |
128 | return addr; |
129 | } |
129 | } |
130 | 130 | ||
131 | /** Find symbols that match parameter and prints them */ |
131 | /** Find symbols that match parameter and prints them */ |
132 | void symtab_print_search(const char *name) |
132 | void symtab_print_search(const char *name) |
133 | { |
133 | { |
134 | int i; |
134 | int i; |
135 | __address addr; |
135 | uintptr_t addr; |
136 | char *realname; |
136 | char *realname; |
137 | 137 | ||
138 | 138 | ||
139 | i = 0; |
139 | i = 0; |
140 | while (symtab_search_one(name, &i)) { |
140 | while (symtab_search_one(name, &i)) { |
141 | addr = __u64_le2host(symbol_table[i].address_le); |
141 | addr = uint64_t_le2host(symbol_table[i].address_le); |
142 | realname = symbol_table[i].symbol_name; |
142 | realname = symbol_table[i].symbol_name; |
143 | printf("%.*p: %s\n", sizeof(__address) * 2, addr, realname); |
143 | printf("%.*p: %s\n", sizeof(uintptr_t) * 2, addr, realname); |
144 | i++; |
144 | i++; |
145 | } |
145 | } |
146 | } |
146 | } |
147 | 147 | ||
148 | /** Symtab completion |
148 | /** Symtab completion |