diff options
author | hunt <hunt> | 2008-02-27 19:45:45 +0000 |
---|---|---|
committer | hunt <hunt> | 2008-02-27 19:45:45 +0000 |
commit | 9a5de18784b77de82e5121861fac892c2d4d2630 (patch) | |
tree | 54d0a3fb138a31627788606953bb1cb37897caf8 /runtime/staprun/symbols.c | |
parent | a2dc47ddef0dbed1b0dc912c876f5f57f97c1ede (diff) | |
download | systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.tar.gz systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.tar.xz systemtap-steved-9a5de18784b77de82e5121861fac892c2d4d2630.zip |
2008-02-27 Martin Hunt <hunt@redhat.com>
* sym.h (_stp_module): Add text_size, lock, and unwind data
pointer.
* sym.c (_stp_find_module_by_addr): New function.
(_stp_kallsyms_lookup): Call _stp_find_module_by_addr().
(_stp_get_unwind_info): New.
* runtime.h: Move debug macros to debug.h. Include it.
* debug.h: New file.
* map.c: Update debug calls.
* map-gen.c: Update debug calls.
* pmap-gen.c: Update debug calls.
* mempool.c: New file.
* symbols.c: Use rwlocks. Use new dbug macros. Handle
unwind info if present.
* transport.c: Include mempool.c. Update dbug and kbug calls
to new macros.
* transport_msgs.h (_stp_command_name): Add
struct containing message names for debugging.
* control.c, procfs.c: Use new dbug macros. Use
new mempool functions.
Diffstat (limited to 'runtime/staprun/symbols.c')
-rw-r--r-- | runtime/staprun/symbols.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/runtime/staprun/symbols.c b/runtime/staprun/symbols.c index e33ee624..c7362d9e 100644 --- a/runtime/staprun/symbols.c +++ b/runtime/staprun/symbols.c @@ -19,9 +19,10 @@ static int send_data(int32_t type, void *data, int len) return write(control_channel, data, len); } + /* Get the sections for a module. Put them in the supplied buffer */ /* in the following order: */ -/* [struct _stp_msg_module][struct _stp_symbol sections ...][string data]*/ +/* [struct _stp_msg_module][struct _stp_symbol sections ...][string data][unwind data] */ /* Return the total length of all the data. */ #define SECDIR "/sys/module/%s/sections" @@ -31,8 +32,9 @@ static int get_sections(char *name, char *data_start, int datalen) char filename[STP_MODULE_NAME_LEN + 256]; char buf[32], strdata_start[32768]; char *strdata=strdata_start, *data=data_start; - int fd, len, res; + int fd, len, res, unwind_data_len=0; struct _stp_msg_module *mod = (struct _stp_msg_module *)data_start; + struct dirent *d; DIR *secdir; void *sec; @@ -63,6 +65,9 @@ static int get_sections(char *name, char *data_start, int datalen) return -1; } + /* FIXME: optionally fill in unwind data here */ + mod->unwind_len = unwind_data_len; + while ((d = readdir(secdir))) { char *secname = d->d_name; @@ -138,6 +143,14 @@ static int get_sections(char *name, char *data_start, int datalen) while (len--) *data++ = *strdata++; +#if 0 + if (unwind_data_len) { + if ((unwind_data_len + data - data_start) > datalen) + goto err0; + memcpy(data, unwind_data, unwind_data_len); + data += unwind_data_len; + } +#endif return data - data_start; err1: @@ -211,7 +224,7 @@ int do_kernel_symbols(void) int ret, num_syms, i = 0, struct_symbol_size; int max_syms= MAX_SYMBOLS, data_basesize = MAX_SYMBOLS*32; - if (kernel_ptr_size == 8) + if (kernel_ptr_size == 8) struct_symbol_size = sizeof(struct _stp_symbol64); else struct_symbol_size = sizeof(struct _stp_symbol32); @@ -285,10 +298,12 @@ int do_kernel_symbols(void) if (num_syms <= 0) goto err; + /* send header */ struct _stp_msg_symbol_hdr smsh; smsh.num_syms = num_syms; smsh.sym_size = (uint32_t)(dataptr - data_base); + smsh.unwind_size = (uint32_t)0; if (send_request(STP_SYMBOLS, &smsh, sizeof(smsh)) <= 0) goto err; |