diff options
author | Tim Potter <tpot@samba.org> | 2003-11-06 21:51:08 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-11-06 21:51:08 +0000 |
commit | 0cd8bc6be4fd618c53c5e589bf9ac2e76e3b78c3 (patch) | |
tree | 359d30db67c1a52a579748fd58dc2df6cc037827 /source3/lib | |
parent | b922425cacd85d32b1471836636ab3675ebb17be (diff) | |
download | samba-0cd8bc6be4fd618c53c5e589bf9ac2e76e3b78c3.tar.gz samba-0cd8bc6be4fd618c53c5e589bf9ac2e76e3b78c3.tar.bz2 samba-0cd8bc6be4fd618c53c5e589bf9ac2e76e3b78c3.zip |
Ignore tallocdump binary.
(This used to be commit addeb1c6c90faf5842db4a75f8db8d2325905b03)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/talloctort.c | 4 | ||||
-rw-r--r-- | source3/lib/util.c | 111 |
2 files changed, 113 insertions, 2 deletions
diff --git a/source3/lib/talloctort.c b/source3/lib/talloctort.c index ad5de38581..0cdf693bb9 100644 --- a/source3/lib/talloctort.c +++ b/source3/lib/talloctort.c @@ -51,9 +51,9 @@ int main(void) } for (i = 0; i < NCTX; i++) { - printf("talloc@%p %-40s %dkB\n", ctx[i], + printf("talloc@%p %-40s %ldkB\n", ctx[i], talloc_pool_name(ctx[i]), - talloc_pool_size(ctx[i]) >> 10); + (unsigned long)talloc_pool_size(ctx[i]) >> 10); } printf("%s", talloc_describe_all(ctx[0])); diff --git a/source3/lib/util.c b/source3/lib/util.c index ce1389c8e9..d95ed406eb 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -23,6 +23,14 @@ #include "includes.h" +#ifdef HAVE_BFD_H +#include <bfd.h> +#endif + +#ifdef HAVE_LIBUNWIND_H +#include <libunwind.h> +#endif + #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT)) #ifdef WITH_NISPLUS_HOME #ifdef BROKEN_NISPLUS_INCLUDE_FILES @@ -1362,6 +1370,17 @@ gid_t nametogid(const char *name) Something really nasty happened - panic ! ********************************************************************/ +#if 0 + +static int found; + +static void +find_address_in_section(bfd *abfd, asection *section, void *data) +{ +} + +#endif + void smb_panic(const char *why) { char *cmd; @@ -1399,6 +1418,98 @@ void smb_panic(const char *why) } DEBUG(0,("PANIC: %s\n", why)); +#if 0 + +#ifdef HAVE_LIBUNWIND +#ifdef HAVE_LIBBFD + + { + bfd *abfd; + long symcount; + unsigned int size, num_frames = 0; + asymbol **syms=NULL; /* Symbol table. */ + unw_context_t uc; + unw_cursor_t cursor; + + bfd_init(); + + if ((abfd = bfd_openr("/proc/self/exe", NULL)) == NULL) { + DEBUG(5, ("bfd_openr() failed\n")); + goto out; + } + +#if 0 + + DEBUG(0, ("**here\n")); + + if (bfd_check_format(abfd, bfd_archive)) { + DEBUG(5, ("bfd_check_format() not an archive\n")); + goto out; + } + + DEBUG(0, ("**here\n")); + DEBUG(0, ("flags = %x\n", bfd_get_file_flags (abfd))); + + if ((bfd_get_file_flags (abfd) & HAS_SYMS) == 0) { + DEBUG(5, ("no symbols in executable\n")); + goto out; + } + + DEBUG(0, ("**here\n")); + +#endif + + symcount = bfd_read_minisymbols(abfd, FALSE, &syms, &size); + if (symcount == 0) + symcount = bfd_read_minisymbols(abfd, TRUE /* dynamic */, + &syms, &size); + + DEBUG(0, ("**here\n")); + + if (symcount < 0) { + DEBUG(5, ("error reading symbols\n")); + goto out; + } + +#define UNW_LOCAL_ONLY /* Optimise for unwinding only local processes */ + + DEBUG(0, ("**here\n")); + + unw_getcontext(&uc); + unw_init_local(&cursor, &uc); + while (unw_step(&cursor) > 0) { + unw_word_t ip; + fstring s; + bfd_vma pc; + + DEBUG(0, ("**here\n")); + + unw_get_reg(&cursor, UNW_REG_IP, &ip); + DEBUG(0, ("ip = 0x08%x\n", (void *) ip)); + slprintf(s, sizeof(s) - 1, "0x%08x", ip); + + pc = bfd_scan_vma(s, NULL, 16); + + found = False; + bfd_map_over_sections(abfd, find_address_in_section, NULL); + DEBUG(0, (" #%d %s [0x%08x]\n", num_frames, + found ? "found": "<unknown>", ip)); + num_frames++; + } + + out: + DEBUG(0, ("outta here!\n")); + } +#endif + + + { + } + +#endif + +#endif + #ifdef HAVE_BACKTRACE_SYMBOLS /* get the backtrace (stack frames) */ backtrace_size = backtrace(backtrace_stack,BACKTRACE_STACK_SIZE); |