0

I'm looking for tips to find a direction where I have to investigate.

I have a little c++ project that works well both on my old cygwin (3.0.4(0.338/5/3)) and on a debian distrib (thanks to Posix) In this project I use some libraries like log4cplus (cxxTest, rapidJson, ...)

Now I had to upgrade my cygwin. So I install a new version of cygwin (3.3.4(0.341/5/3)) totally separated from the previous one. With this new cygwin, I have 2 problems:

  • The real problem : my program sometimes (2 of 10 times) work well without problem. And very often the program did nothing and end without any information
  • The second problem is that gdb (GNU gdb (GDB) (Cygwin 10.2-1) 10.2) : won't debug my program. Each time I try I have :
gdb: unknown target exception 0x80000001 at 0x7ffc741dd147
Thread 9 received signal ?, Unknown signal.

In order to find the problem I make a very simple code to reproduce the problem. And finally it was very simple, I do this :

#include <iostream>
#include <log4cplus/initializer.h>
#include <log4cplus/configurator.h>

using namespace std;

/// ***************************************************************************
/// Initialisation of log4cplus library
/// ***************************************************************************
void log4cplusInit() {
    try {
        log4cplus::initialize();
        //log4cplus::PropertyConfigurator::doConfigure("config/log4cplus.ini");
    }
    catch(std::exception& e)
    {
        cout << e.what() << endl;
    }
    catch(...) {
        cout << "Unexpected exception" << std::endl;
    }
}

int main() {
    //log4cplusInit();
    cout << "Hello World " << endl;
}

Things that I already find/try :

  • If I comment the line log4cplus::initialize(); The program works.
  • The 2 Lines log4cplus::XXXX have the same impact : if one of this line is present, I have the bug, If both are commented then everything is fine
  • The try catch never catch anything
  • I try to catch every signal, for gdb problem, before finding this trhead : cygwin gdb Program received signal ?, Unknown signal (but didn't help me)
  • I don't understand why an unused code could have this impact (log4cplusInit() is commented and never called)

So I'm looking for an idea where I can start. I want to investigate this bug, but I have no clue.

PS: I already have open an issue in log4cplus github. Don't know if I have to open one in cygwin

Any help will be appreciated :)

zzDiego
  • 37
  • 1
  • 8
  • 1
    is your log4clpus compiled with your new cygwin or the old one? Do you really need to use cygwin? WSL, mingw or even visual studio may be better solutions now – Alan Birtles Mar 22 '22 at 13:56
  • Sorry I forgot to mention that. Yes I recompiled log4cplus with my new cygwin (without problem). I don't really need cygwin, but I used it since years so It's the force of habbits. I'm already thinking of switching to mingw, but today it's just an idea (but if I had no choice, I will) – zzDiego Mar 22 '22 at 14:06
  • 1
    Have you tried debugging the exception in gdb? Seems to be a guard page violation: https://learn.microsoft.com/en-us/windows/win32/memory/creating-guard-pages – Alan Birtles Mar 22 '22 at 14:25

1 Answers1

0

For every people who read this thread in future :

I don't really find a solution in Cygwin, but like @Alan Birtles mention : Use WSL (or another updated solution). It work like a charm. thanks to microsoft ;)

zzDiego
  • 37
  • 1
  • 8