Subversion Repositories HelenOS

Rev

Rev 4273 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4273 Rev 4490
Line 53... Line 53...
53
 *
53
 *
54
 */
54
 */
55
int symtab_name_lookup(unative_t addr, char **name)
55
int symtab_name_lookup(unative_t addr, char **name)
56
{
56
{
57
#ifdef CONFIG_SYMTAB
57
#ifdef CONFIG_SYMTAB
58
    count_t i;
58
    size_t i;
59
   
59
   
60
    for (i = 1; symbol_table[i].address_le; i++) {
60
    for (i = 1; symbol_table[i].address_le; i++) {
61
        if (addr < uint64_t_le2host(symbol_table[i].address_le))
61
        if (addr < uint64_t_le2host(symbol_table[i].address_le))
62
            break;
62
            break;
63
    }
63
    }
Line 110... Line 110...
110
 * @param startpos Starting position, changes to found position
110
 * @param startpos Starting position, changes to found position
111
 *
111
 *
112
 * @return Pointer to the part of string that should be completed or NULL.
112
 * @return Pointer to the part of string that should be completed or NULL.
113
 *
113
 *
114
 */
114
 */
115
static const char *symtab_search_one(const char *name, count_t *startpos)
115
static const char *symtab_search_one(const char *name, size_t *startpos)
116
{
116
{
117
    count_t namelen = str_length(name);
117
    size_t namelen = str_length(name);
118
   
118
   
119
    count_t pos;
119
    size_t pos;
120
    for (pos = *startpos; symbol_table[pos].address_le; pos++) {
120
    for (pos = *startpos; symbol_table[pos].address_le; pos++) {
121
        const char *curname = symbol_table[pos].symbol_name;
121
        const char *curname = symbol_table[pos].symbol_name;
122
       
122
       
123
        /* Find a ':' in curname */
123
        /* Find a ':' in curname */
124
        const char *colon = str_chr(curname, ':');
124
        const char *colon = str_chr(curname, ':');
Line 151... Line 151...
151
 *
151
 *
152
 */
152
 */
153
int symtab_addr_lookup(const char *name, uintptr_t *addr)
153
int symtab_addr_lookup(const char *name, uintptr_t *addr)
154
{
154
{
155
#ifdef CONFIG_SYMTAB
155
#ifdef CONFIG_SYMTAB
156
    count_t found = 0;
156
    size_t found = 0;
157
    count_t pos = 0;
157
    size_t pos = 0;
158
    const char *hint;
158
    const char *hint;
159
   
159
   
160
    while ((hint = symtab_search_one(name, &pos))) {
160
    while ((hint = symtab_search_one(name, &pos))) {
161
        if (str_length(hint) == 0) {
161
        if (str_length(hint) == 0) {
162
            *addr = uint64_t_le2host(symbol_table[pos].address_le);
162
            *addr = uint64_t_le2host(symbol_table[pos].address_le);
Line 180... Line 180...
180
 
180
 
181
/** Find symbols that match parameter and print them */
181
/** Find symbols that match parameter and print them */
182
void symtab_print_search(const char *name)
182
void symtab_print_search(const char *name)
183
{
183
{
184
#ifdef CONFIG_SYMTAB
184
#ifdef CONFIG_SYMTAB
185
    count_t pos = 0;
185
    size_t pos = 0;
186
    while (symtab_search_one(name, &pos)) {
186
    while (symtab_search_one(name, &pos)) {
187
        uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
187
        uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
188
        char *realname = symbol_table[pos].symbol_name;
188
        char *realname = symbol_table[pos].symbol_name;
189
        printf("%p: %s\n", addr, realname);
189
        printf("%p: %s\n", addr, realname);
190
        pos++;
190
        pos++;
Line 201... Line 201...
201
 * @param size  Input buffer size
201
 * @param size  Input buffer size
202
 *
202
 *
203
 * @return 0 - nothing found, 1 - success, >1 print duplicates
203
 * @return 0 - nothing found, 1 - success, >1 print duplicates
204
 *
204
 *
205
 */
205
 */
206
int symtab_compl(char *input, count_t size)
206
int symtab_compl(char *input, size_t size)
207
{
207
{
208
#ifdef CONFIG_SYMTAB
208
#ifdef CONFIG_SYMTAB
209
    const char *name = input;
209
    const char *name = input;
210
   
210
   
211
    /* Allow completion of pointers */
211
    /* Allow completion of pointers */
Line 214... Line 214...
214
   
214
   
215
    /* Do not print all symbols */
215
    /* Do not print all symbols */
216
    if (str_length(name) == 0)
216
    if (str_length(name) == 0)
217
        return 0;
217
        return 0;
218
   
218
   
219
    count_t found = 0;
219
    size_t found = 0;
220
    count_t pos = 0;
220
    size_t pos = 0;
221
    const char *hint;
221
    const char *hint;
222
    char output[MAX_SYMBOL_NAME];
222
    char output[MAX_SYMBOL_NAME];
223
   
223
   
224
    output[0] = 0;
224
    output[0] = 0;
225
   
225