Git Product home page Git Product logo

Comments (14)

rdipardo avatar rdipardo commented on August 28, 2024 1

I should have suggested this to start with, but if you check what the pre-processor emits in debug mode, you'll see the expected code path is actually getting compiled:

g++ -DDEBUG --std=c++17 -Wpedantic -Wall -g -DSCI_OWNREGEX \
-I../../scintilla/include -I../../lexilla/include -I../src \
-I../src/ScintillaComponent -I../src/TinyXml -I../src/TinyXml/tinyXmlA \
-I../src/MISC/Common -I../src//MISC/PluginsManager -I../src/MISC/Process \
-I../src/WinControls/AboutDlg -I../src/WinControls -I../src/WinControls/AnsiCharPanel \
-I../src/WinControls/ContextMenu -I../src/WinControls/ColourPicker \
-I../src/WinControls/TabBar -I../src/WinControls//ImageListSet \
-I../src/WinControls/StaticDialog -I../src/WinControls/shortcut \
-I../src/WinControls/ToolBar -I../src/json -I../../boostregex \
-E ../src/WinControls/PluginsAdmin/pluginsAdmin.cpp > pluginsAdmin.pre.processed.cpp

pluginsAdmin cpp debug path

That leaves the question of why GDB appeared to be stepping into the release code path in your screen capture. đŸ€”

from npppluginlist.

chcg avatar chcg commented on August 28, 2024 1

Sorry I didn't spot it above.

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

It looks like the issue is that a debug build of gcc does not count as a debug version :-(

image

from npppluginlist.

rdipardo avatar rdipardo commented on August 28, 2024

It looks like the issue is that a debug build of gcc does not count as a debug version :-(

Did you define _DEBUG for the GCC compiler, the way the VC++ project file does for MSVC?

<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;NPPPLUGINLIST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

Other relevant info:

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Thank you for your interest in my problem.
It looks like gcc wants to see an environment variable called DEBUG with some value, so I defined DEBUG=1 and it creates a debug build. The file is > 100MB and I can use gdb to see the symbols.
For the build process I followed the instructions on how to build with gcc.
I opened a git-bash, exported DEBUG=1 and ran mingw32-make.
Don't be confused by the name, it still sees that I'm on x64 and builds a 64bit executable.

But you are right that DEBUG is not passed to the build. In the makefile would be a
CPP_DEFINE += DEBUG
but this is commented and if I comment it out then the build fails.
Probably the reason why it is commented.

from npppluginlist.

rdipardo avatar rdipardo commented on August 28, 2024

Sorry to ask another silly question, but did you also try editing the pl.x64.json manifest under src and recompiling nppPluginList.dll? Ordinarily the list is embedded as a resource string:

#ifdef _M_ARM64
#define PLJSON "pl.arm64.json"
#else
#define PLJSON "pl.x64.json"
#endif

To be honest, I wasn't aware you could edit an external manifest and have it dynamically loaded by the module 😊

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Don't be sorry - I'm grateful for any help I get.
No, I didn't, I followed the instruction from the manual ... hmm ... maybe that's one way to make it work.
I'll give it a try. Thank you very much. :-)

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Thank you for all the testing and research you do.
I have not used the VERBOSE environment variable before and yes, that makes it even more confusing ... we should assume it has DEBUG defined ... but I don't see the pre-processing step being done for me.

image

These are the only two instances of pluginsAdmin.cpp that I see, and I don't see any line with -E at all.

I do see a couple of lines starting with g++ -DDEBUG ... but not for pluginsAdmin.

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Btw ... I'm using g++.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.2.0
I think, that is the one you use as well, correct?

from npppluginlist.

chcg avatar chcg commented on August 28, 2024

Maybe you want to check:
https://github.com/chcg/notepad-plus-plus/blob/master/PowerEditor/gcc/makefile#L63
unclear why it is commented out.

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Thanks - I tried that already, with the result that the compilation fails. I assume that is why it is commented.

from npppluginlist.

rdipardo avatar rdipardo commented on August 28, 2024

@Ekopalypse,

I tried that already, with the result that the compilation fails.

In fact, it fails at exactly the code path you want: the call to PluginsAdminDlg::initFromJson():

../src/WinControls/PluginsAdmin/pluginsAdmin.cpp: In member function 'bool PluginsAdminDlg::initFromJson()':
../src/WinControls/PluginsAdmin/pluginsAdmin.cpp:709:55: error: no matching function for call to 'std::basic_ifstream<char>::basic_ifstream(generic_string&)'
  709 |         ifstream nppPluginListJson(_pluginListFullPath);
    |                                                       ^
In file included from ../src/WinControls/PluginsAdmin/pluginsAdmin.cpp:20:
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:584:9: note: candidate: 'template<class _Path, class _Require> std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const _Path&, std::ios_base::openmode) [with _Path = _Path; _Require = _Require; _CharT = char; _Traits = std::char_traits<char>]'
  584 |         basic_ifstream(const _Path& __s,
    |         ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:584:9: note:   template argument deduction/substitution failed:
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:583:32: error: 'class std::__cxx11::basic_string<wchar_t>' has no member named 'make_preferred'
  583 |       template<typename _Path, typename _Require = _If_fs_path<_Path>>
    |                                ^~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:592:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(std::basic_ifstream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  592 |       basic_ifstream(basic_ifstream&& __rhs)
    |       ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:592:39: note:   no known conversion for argument 1 from 'generic_string' {aka 'std::__cxx11::basic_string<wchar_t>'} to 'std::basic_ifstream<char>&&'
  592 |       basic_ifstream(basic_ifstream&& __rhs)
    |                      ~~~~~~~~~~~~~~~~~^~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:567:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]'
  567 |       basic_ifstream(const std::string& __s,
    |       ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:567:41: note:   no known conversion for argument 1 from 'generic_string' {aka 'std::__cxx11::basic_string<wchar_t>'} to 'const string&' {aka 'const std::__cxx11::basic_string<char>&'}
  567 |       basic_ifstream(const std::string& __s,
    |                      ~~~~~~~~~~~~~~~~~~~^~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:549:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]'
  549 |       basic_ifstream(const wchar_t* __s,
    |       ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:549:37: note:   no known conversion for argument 1 from 'generic_string' {aka 'std::__cxx11::basic_string<wchar_t>'} to 'const wchar_t*'
  549 |       basic_ifstream(const wchar_t* __s,
    |                      ~~~~~~~~~~~~~~~^~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:534:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]'
  534 |       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
    |       ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:534:34: note:   no known conversion for argument 1 from 'generic_string' {aka 'std::__cxx11::basic_string<wchar_t>'} to 'const char*'
  534 |       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
    |                      ~~~~~~~~~~~~^~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:523:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits<char>]'
  523 |       basic_ifstream() : __istream_type(), _M_filebuf()
    |       ^~~~~~~~~~~~~~
c:\winlibs-mingw-msvcrt\current\include\c++\11.2.0\fstream:523:7: note:   candidate expects 0 arguments, 1 provided
mingw32-make[1]: *** [makefile:239: bin.x86_64-debug.build/WinControls/PluginsAdmin/pluginsAdmin.o] Error 1
mingw32-make[1]: *** Waiting for unfinished jobs....

Looks like an issue with MinGW's support of the C++17 standard.
As it currently makes debug builds impossible, there will definitely be a patch against N++ when this gets figured out.

from npppluginlist.

rdipardo avatar rdipardo commented on August 28, 2024

@Ekopalypse, does it work better like this?

diff --git a/PowerEditor/gcc/makefile b/PowerEditor/gcc/makefile
index 4f0ce59f..c97ced4d 100644
--- a/PowerEditor/gcc/makefile
+++ b/PowerEditor/gcc/makefile
@@ -60,7 +60,7 @@ else
 BUILD_TYPE := debug
 BUILD_SUFFIX := -debug
 CXXFLAGS += -Og -g -Wall -Wpedantic -Wconversion-null
-#CPP_DEFINE += DEBUG
+CPP_DEFINE += DEBUG
 endif
 
 #
diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp
index 8a091ad1..34f52373 100644
--- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp
+++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp
@@ -706,7 +706,11 @@ bool PluginsAdminDlg::initFromJson()
 #ifdef DEBUG // if not debug, then it's release
 	
 	// load from nppPluginList.json instead of nppPluginList.dll
+#ifdef __MINGW32__
+	ifstream nppPluginListJson(_pluginListFullPath.c_str());
+#else
 	ifstream nppPluginListJson(_pluginListFullPath);
+#endif	
 	nppPluginListJson >> j;
 
 #else //RELEASE

0001-Fix-GCC-Debug-build.diff.txt

from npppluginlist.

Ekopalypse avatar Ekopalypse commented on August 28, 2024

Brilliant, YES, this works!!
Thank you very much.

image

Don't be confused by the "build time", it still shows yesterday's date because I replaced the existing exe with the newly created exe.

from npppluginlist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.