From 49b78c1f802329d7bb4f8e7fa4947914f06c9b56 Mon Sep 17 00:00:00 2001 From: safety0ff Date: Sun, 3 Apr 2011 21:39:02 -0400 Subject: [PATCH] Fix exchndl.cpp to work with recent versions of BFD. Hopefully fixes #343. --- lib/exceptionhandler/exchndl.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/lib/exceptionhandler/exchndl.cpp b/lib/exceptionhandler/exchndl.cpp index 3d5e67e8c..961a39a52 100644 --- a/lib/exceptionhandler/exchndl.cpp +++ b/lib/exceptionhandler/exchndl.cpp @@ -754,27 +754,9 @@ bool StackBackTrace(HANDLE hProcess, HANDLE hThread, PCONTEXT pContext) if((abfd = bfd_openr (szModule, NULL))) if(bfd_check_format(abfd, bfd_object)) - { - bfd_vma adjust_section_vma = 0; - - /* If we are adjusting section VMA's, change them all now. Changing - the BFD information is a hack. However, we must do it, or - bfd_find_nearest_line will not do the right thing. */ - if ((adjust_section_vma = (bfd_vma) hModule - pe_data(abfd)->pe_opthdr.ImageBase)) - { - asection *s; - - for (s = abfd->sections; s != NULL; s = s->next) - { - s->vma += adjust_section_vma; - s->lma += adjust_section_vma; - } - } - if(bfd_get_file_flags(abfd) & HAS_SYMS) /* Read in the symbol table. */ slurp_symtab(abfd, &syms, &symcount); - } } if(!bSuccess && abfd && syms && symcount) @@ -1208,6 +1190,11 @@ void ExchndlSetup() { # if defined(WZ_CC_MINGW) TCHAR miniDumpPath[PATH_MAX] = {'\0'}; + +#ifdef HAVE_BFD + bfd_init(); +#endif /* HAVE_BFD */ + // Install the unhandled exception filter function prevExceptionFilter = SetUnhandledExceptionFilter(TopLevelExceptionFilter);