diff options
Diffstat (limited to 'runtime/staprun')
-rw-r--r-- | runtime/staprun/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 12 | ||||
-rw-r--r-- | runtime/staprun/unwind_data.c | 97 |
3 files changed, 5 insertions, 109 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog index 969c299d..27f4d8c8 100644 --- a/runtime/staprun/ChangeLog +++ b/runtime/staprun/ChangeLog @@ -1,3 +1,8 @@ +2008-06-03 Frank Ch. Eigler <fche@elastic.org> + + PR 6429. + * mainloop.c (stp_main_loop): Remove STP_UNWIND message support. + 2008-05-05 Martin Hunt <hunt@redhat.com> * mainloop.c (child_proc): Handle sig_chld diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 61963743..2bbadbc9 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -387,18 +387,6 @@ int stp_main_loop(void) cleanup_and_exit(1); break; } - case STP_UNWIND: - { - int len; - char *ptr = (char *)data; - while (nb > 0) { - send_unwind_data(ptr); - len = strlen(ptr) + 1; - ptr += len; - nb -= len; - } - break; - } default: err("WARNING: ignored message of type %d\n", (type)); } diff --git a/runtime/staprun/unwind_data.c b/runtime/staprun/unwind_data.c deleted file mode 100644 index ed27cc20..00000000 --- a/runtime/staprun/unwind_data.c +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- linux-c -*- - * Unwind data functions for staprun. - * - * Copyright (C) 2008 Red Hat Inc. - * - * This file is part of systemtap, and is free software. You can - * redistribute it and/or modify it under the terms of the GNU General - * Public License (GPL); either version 2, or (at your option) any - * later version. - */ - -#include "staprun.h" -#include <elfutils/libdwfl.h> -#include <dwarf.h> - -static char debuginfo_path_arr[] = "-:.debug:/usr/lib/debug"; -static char *debuginfo_path = debuginfo_path_arr; -static const Dwfl_Callbacks kernel_callbacks = { - .find_debuginfo = dwfl_standard_find_debuginfo, - .debuginfo_path = &debuginfo_path, - .find_elf = dwfl_linux_kernel_find_elf, - .section_address = dwfl_linux_kernel_module_section_address, -}; - -void *get_module_unwind_data(Dwfl * dwfl, const char *name, int *len) -{ - Dwarf_Addr bias = 0; - Dwarf *dw; - GElf_Ehdr *ehdr, ehdr_mem; - GElf_Shdr *shdr, shdr_mem; - Elf_Scn *scn = NULL; - Elf_Data *data = NULL; - - Dwfl_Module *mod = dwfl_report_module(dwfl, name, 0, 0); - dwfl_report_end(dwfl, NULL, NULL); - dw = dwfl_module_getdwarf(mod, &bias); - Elf *elf = dwarf_getelf(dw); - ehdr = gelf_getehdr(elf, &ehdr_mem); - while ((scn = elf_nextscn(elf, scn))) { - shdr = gelf_getshdr(scn, &shdr_mem); - if (strcmp(elf_strptr(elf, ehdr->e_shstrndx, shdr->sh_name), ".debug_frame") == 0) { - data = elf_rawdata(scn, NULL); - break; - } - } - - if (data == NULL) { - *len = 0; - dbug(2, "module %s returns NULL\n", name); - return NULL; - } - dbug(2, "module %s returns %d\n", name, (int)data->d_size); - *len = data->d_size; - return data->d_buf; -} - -void send_unwind_data(const char *name) -{ - struct _stp_msg_unwind *un; - int unwind_data_len = 0; - void *unwind_data = NULL; - char *buf; - - dbug(2, "module %s\n", name); - if (strcmp(name, "*")) { - Dwfl *dwfl = dwfl_begin(&kernel_callbacks); - - if (name[0] == 0) - unwind_data = get_module_unwind_data(dwfl, "kernel", &unwind_data_len); - else - unwind_data = get_module_unwind_data(dwfl, name, &unwind_data_len); - - /* yuck */ - buf = (char *)malloc(unwind_data_len + sizeof(*un) + sizeof(uint32_t)); - if (!buf) { - err("malloc failed\n"); - return; - } - memcpy(buf + sizeof(*un) + sizeof(uint32_t), unwind_data, unwind_data_len); - dwfl_end(dwfl); - } else { - buf = (char *)malloc(sizeof(*un) + sizeof(uint32_t)); - if (!buf) { - err("malloc failed\n"); - return; - } - } - - un = (struct _stp_msg_unwind *)(buf + sizeof(uint32_t)); - strncpy(un->name, name, sizeof(un->name)); - un->unwind_len = unwind_data_len; - *(uint32_t *) buf = STP_UNWIND; - - /* send unwind data */ - if (write(control_channel, buf, unwind_data_len + sizeof(*un) + sizeof(uint32_t)) <= 0) - err("write failed\n"); -} |