cvs.delorie.com/djgpp/doc/libc/libc_793.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

syms_listwild

Syntax

 
#include <debug/syms.h>

void syms_listwild (char *pattern,
                    void (*handler) (unsigned long addr, char type_c,
                                     char *name, char *file, int lnum));

Description

This function walks through all the symbols that were read by a previous call to syms_init (see section syms_init). For each symbol whose name matches pattern, it invokes the user-defined function handler, passing it information about that symbol:

address
the address of the symbol.

type_c
a letter that specifies the type of the symbol, as follows:

`T'
`t'
"text", or code: usually a function.

`D'
`d'
data: an initialized variable.

`B'
`b'
"bss": an uninitialized variable.

`F'
`f'
a function (in a.out file only).

`V'
`v'
a set element or pointer (in a.out file only).

`I'
`i'
an indirect symbol (in a.out file only).

`U'
`u'
an undefined (a.k.a. unresolved) symbol.

`A'
`a'
an absolute symbol.

name
the name of the symbol.

file
the source file name where the symbol is defined.

lnum
the line number on which the symbol is defined in the source file.

Since variables and functions defined in C get prepended with an underscore `_', begin pattern with `_' if you want it to match C symbols.

You must call syms_init (see section syms_init) before calling any of the other syms_* functions for the first time.

Return Value

None.

Portability

ANSI/ISO C No
POSIX No

Example

 
  void print_sym (unsigned long addr, char type_c,
                  char *name, char *file, int lnum)
  {
    printf (file ? "%s: %lx %c %s:%d\n" : "%s: %lx %c\n",
            name, addr, type_c,
            file ? file : "", lnum );
  }

  int main (void)
  {
    syms_init ("foo.exe");
    /* List all the symbols which begin with "___djgpp".  */
    syms_listwild ("___djgpp*", print_sym);
    return 0;
  }


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004