Author Topic: exchndl for C::B 64bit versions / Windows  (Read 9141 times)

Offline gd_on

  • Regular
  • ***
  • Posts: 468
exchndl for C::B 64bit versions / Windows
« on: February 03, 2014, 07:45:57 pm »
I'm able to generate C::B in 64 bits for Windows with wxwidgets 2.8.12. Until now OK, less problems than with wx30.
But I'm not able to generate exchndl.dll.
I know that there is a special target generation for it in codeblocks*.cbp but there are a few problems.
Some of the targets use library libz, some other use libintl. I have libintl.a in 32 bits versions but "only" a dll in 64 bits (libintl-8). In any case, I have not a libz .a or .dll.
I can compile this dll in 32 bits, but in 64 bits I have compiling errors.
Here is the full log :
Quote

-------------- Nettoyer : Release_64 dans exchndl (compilateur : GNU GCC Compiler)---------------

Nettoyés "exchndl - Release_64"

-------------- Générer : Release_64 dans exchndl (compilateur : GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -DBUILD_DLL -O2 -Iinclude -c C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c -o obj\Release_64\exchndl.o
mingw32-g++.exe -shared -Wl,--output-def=bin\Release_64\libexchndl.def -Wl,--out-implib=bin\Release_64\libexchndl.a -Wl,--dll  obj\Release_64\exchndl.o  -o bin\Release_64\exchndl.dll -s  -lbfd -lintl -liberty -luser32
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'GetModuleBase':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:50:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  return VirtualQuery((LPCVOID) dwAddress, &Buffer, sizeof(Buffer)) ? (DWORD) Buffer.AllocationBase : 0;
                      ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:50:70: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  return VirtualQuery((LPCVOID) dwAddress, &Buffer, sizeof(Buffer)) ? (DWORD) Buffer.AllocationBase : 0;
                                                                      ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'BfdGetSymFromAddr':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:151:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  if(!(hModule = (HMODULE) GetModuleBase(dwAddress)))
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'BfdGetLineFromAddr':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:181:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  if(!(hModule = (HMODULE) GetModuleBase(dwAddress)))
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'PEGetSymFromAddr':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:467:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  if(!(hModule = (HMODULE) GetModuleBase(dwAddress)))
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:481:32: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   pNtHdr = (PIMAGE_NT_HEADERS)((DWORD)hModule + (DWORD)e_lfanew);
                                ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:481:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   pNtHdr = (PIMAGE_NT_HEADERS)((DWORD)hModule + (DWORD)e_lfanew);
            ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:487:38: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  pSection = (PIMAGE_SECTION_HEADER) ((DWORD)pNtHdr + sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER) + NtHdr.FileHeader.SizeOfOptionalHeader);
                                      ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:500:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    pExportDir = (PIMAGE_EXPORT_DIRECTORY) Section.VirtualAddress;
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:502:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    pExportDir = (PIMAGE_EXPORT_DIRECTORY) NtHdr.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:508:44: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + (DWORD)pExportDir), &ExportDir, sizeof(IMAGE_EXPORT_DIRECTORY), NULL))
                                            ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:508:61: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + (DWORD)pExportDir), &ExportDir, sizeof(IMAGE_EXPORT_DIRECTORY), NULL))
                                                             ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:508:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + (DWORD)pExportDir), &ExportDir, sizeof(IMAGE_EXPORT_DIRECTORY), NULL))
                                    ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:515:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + (DWORD)ExportDir.AddressOfFunctions), AddressOfFunctions, ExportDir.NumberOfFunctions*sizeof(PDWORD), NULL))
                                             ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:515:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + (DWORD)ExportDir.AddressOfFunctions), AddressOfFunctions, ExportDir.NumberOfFunctions*sizeof(PDWORD), NULL))
                                     ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:520:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      DWORD pFunction = (DWORD)hModule + (DWORD)AddressOfFunctions[j];
                        ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:520:41: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      DWORD pFunction = (DWORD)hModule + (DWORD)AddressOfFunctions[j];
                                         ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:527:47: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       if(!ReadProcessMemory(hProcess, (PVOID)((DWORD)hModule + ExportDir.AddressOfNames + j*sizeof(DWORD)), &dwNearestName, sizeof(dwNearestName), NULL))
                                               ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:530:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       dwNearestName = (DWORD) hModule + dwNearestName;
                       ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:540:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  if(!ReadProcessMemory(hProcess, (PVOID)dwNearestName, lpSymName, nSize, NULL))
                                  ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'IntelStackWalk':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:563:21: warning: assignment from incompatible pointer type [enabled by default]
   ReadMemoryRoutine = ReadProcessMemory;
                     ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:570:44: error: 'struct _CONTEXT' has no member named 'Eip'
   StackFrame->AddrPC.Offset = ContextRecord->Eip;
                                            ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:572:47: error: 'struct _CONTEXT' has no member named 'Esp'
   StackFrame->AddrStack.Offset = ContextRecord->Esp;
                                               ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:574:47: error: 'struct _CONTEXT' has no member named 'Ebp'
   StackFrame->AddrFrame.Offset = ContextRecord->Ebp;
                                               ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:577:3: warning: passing argument 2 of 'ReadMemoryRoutine' makes integer from pointer without a cast [enabled by default]
   if(!ReadMemoryRoutine(hProcess, (LPCVOID) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), &StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
   ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:577:3: note: expected 'DWORD64' but argument is of type 'const void *'
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:584:3: warning: passing argument 2 of 'ReadMemoryRoutine' makes integer from pointer without a cast [enabled by default]
   if(!ReadMemoryRoutine(hProcess, (LPCVOID) StackFrame->AddrFrame.Offset, &StackFrame->AddrFrame.Offset, sizeof(DWORD), NULL))
   ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:584:3: note: expected 'DWORD64' but argument is of type 'const void *'
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:586:3: warning: passing argument 2 of 'ReadMemoryRoutine' makes integer from pointer without a cast [enabled by default]
   if(!ReadMemoryRoutine(hProcess, (LPCVOID) (StackFrame->AddrFrame.Offset + sizeof(DWORD)), &StackFrame->AddrReturn.Offset, sizeof(DWORD), NULL))
   ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:586:3: note: expected 'DWORD64' but argument is of type 'const void *'
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:590:2: warning: passing argument 2 of 'ReadMemoryRoutine' makes integer from pointer without a cast [enabled by default]
  ReadMemoryRoutine(hProcess, (LPCVOID) (StackFrame->AddrFrame.Offset + 2*sizeof(DWORD)), StackFrame->Params, sizeof(StackFrame->Params), NULL);
  ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:590:2: note: expected 'DWORD64' but argument is of type 'const void *'
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'StackBackTrace':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:619:37: error: 'struct _CONTEXT' has no member named 'Eip'
  StackFrame.AddrPC.Offset = pContext->Eip;
                                     ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:621:40: error: 'struct _CONTEXT' has no member named 'Esp'
  StackFrame.AddrStack.Offset = pContext->Esp;
                                        ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:623:40: error: 'struct _CONTEXT' has no member named 'Ebp'
  StackFrame.AddrFrame.Offset = pContext->Ebp;
                                        ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:651:5: warning: passing argument 7 of 'j_StackWalk' from incompatible pointer type [enabled by default]
     )
     ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:306:13: note: expected 'PFUNCTION_TABLE_ACCESS_ROUTINE64' but argument is of type 'void * (*)(void *, DWORD)'
 BOOL WINAPI j_StackWalk(
             ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:651:5: warning: passing argument 8 of 'j_StackWalk' from incompatible pointer type [enabled by default]
     )
     ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:306:13: note: expected 'PGET_MODULE_BASE_ROUTINE64' but argument is of type 'DWORD (*)(void *, DWORD)'
 BOOL WINAPI j_StackWalk(
             ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:696:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   if((hModule = (HMODULE) GetModuleBase(StackFrame.AddrPC.Offset)) && GetModuleFileName(hModule, szModule, sizeof(szModule)))
                 ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c: In function 'GenerateExceptionReport':
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:982:35: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  rprintf(_T(" at location %08x"), (DWORD) pExceptionRecord->ExceptionAddress);
                                   ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:983:40: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  if((hModule = (HMODULE) GetModuleBase((DWORD) pExceptionRecord->ExceptionAddress)) && GetModuleFileName(hModule, szModule, sizeof(szModule)))
                                        ^
C:\Users\Gerard_2\Documents\CodeBlocks_SVN\CodeBlocks_src\src\base\exchndl\exchndl.c:983:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  if((hModule = (HMODULE) GetModuleBase((DWORD) pExceptionRecord->ExceptionAddress)) && GetModuleFileName(hModule, szModule, sizeof(szModule)))
                ^
Le processus s'est terminé avec le code d'état 1 (0 minute(s), 3 seconde(s))
6 erreur(s), 31 avertissement(s) (0 minute(s), 3 seconde(s))
 

I know that this exchndl is mainly used when C::B crash to create the .rpt file.
Does anybody succeded to create a working exchndl.dll file for C::B 64 bits under windows ?
If, yes, with which complementary dlls ?

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 3.1.2, Compilers 8.1.0, 32 bits (sjlj, posix : gcc and gfortran installed in C:\MinGW32) or 64 bits by Compilers 8.1.0 (seh, posix : in C:\MinGW64).

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: exchndl for C::B 64bit versions / Windows
« Reply #1 on: February 03, 2014, 08:01:24 pm »
Can you please list the steps to create the wxwidgets 2.8.12 dll for 64bits or upload the dll somewhere so I can also try to make a 64bit cb build? Btw I also failed to create the exchndl with mingw 4.8.2 x86_x64 although I can build both wxwidgets 3.0.0 and cb with the same compiler.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: exchndl for C::B 64bit versions / Windows
« Reply #2 on: February 03, 2014, 08:29:46 pm »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline gd_on

  • Regular
  • ***
  • Posts: 468
Re: exchndl for C::B 64bit versions / Windows
« Reply #3 on: February 03, 2014, 09:12:16 pm »
@scarphin
To compile a 64 bit version, I use a standard build process, except I add, as Killerbot suggested some time ago, -fpermissive in cxxflags options. (in http://forums.codeblocks.org/index.php/topic,18741.msg128687.html#msg128687)
Here is the important part of my .bat file :
Quote
path C:\MinGW64\bin;%PATH%
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb_64 clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb_64 CXXFLAGS="-fno-keep-inline-dllexport -fpermissive"
strip ..\..\lib\gcc_dll\wxmsw28u_gcc_cb_64.dll
strip ..\..\lib\gcc_dll\wxmsw28u_gl_gcc_cb_64.dll
You can also find my libs here, compiled with MinGW64, TDM version 4.8.1.

@morten
I did'nt try the original jrfonseca version.

gd_on
« Last Edit: February 03, 2014, 09:29:34 pm by gd_on »
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 3.1.2, Compilers 8.1.0, 32 bits (sjlj, posix : gcc and gfortran installed in C:\MinGW32) or 64 bits by Compilers 8.1.0 (seh, posix : in C:\MinGW64).

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: exchndl for C::B 64bit versions / Windows
« Reply #4 on: February 04, 2014, 04:22:40 am »
gd_on: Thnx, I'll try that and thnx for the dll too in case something goes wrong again.

Offline gd_on

  • Regular
  • ***
  • Posts: 468
Re: exchndl for C::B 64bit versions / Windows
« Reply #5 on: February 04, 2014, 08:36:28 am »
Nevertheless, exchndl does not depend of the wxWidgets version (no relations with a .h or a wx lib). So, I think that if a solution is available, it will be OK for both versions.

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 3.1.2, Compilers 8.1.0, 32 bits (sjlj, posix : gcc and gfortran installed in C:\MinGW32) or 64 bits by Compilers 8.1.0 (seh, posix : in C:\MinGW64).

Offline gd_on

  • Regular
  • ***
  • Posts: 468
Re: exchndl for C::B 64bit versions / Windows
« Reply #6 on: February 05, 2014, 09:15:14 am »
@morten
I tried to use the versions found in
Quote
Did you try the original resource:

http://code.google.com/p/jrfonseca/downloads/list?q=drmingw
and of course more specifically the raw dll found in 64 bit version.
The good new is that it works, but you need to copy both exchndl.dll and mgwhelp.dll in the C::B binary folder.
Like that a .rpt is created when C::B crash (tested on svn 9600, windows 7 pro, by provocating the bug introduced in svn 9599 and corrected later in svn 9603).

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 3.1.2, Compilers 8.1.0, 32 bits (sjlj, posix : gcc and gfortran installed in C:\MinGW32) or 64 bits by Compilers 8.1.0 (seh, posix : in C:\MinGW64).