Author Topic: Bootstrap with no wxWidgets packet installed  (Read 1950 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #15 on: August 10, 2018, 02:55:32 am »
OK, I use GDB to attach to the hanging C::B, and here is the bt:

Code: [Select]
(gdb) bt 30
#0  0x00007fe35da69ed7 in wxMBConv::ToWChar(wchar_t*, unsigned long, char const*, unsigned long) const ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#1  0x00007fe35daa2214 in wxTextInputStream::GetChar() ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#2  0x00007fe35daa23c0 in wxTextInputStream::ReadLine() ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#3  0x00007fe35db36912 in ReadAll(wxInputStream*, wxArrayString&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#4  0x00007fe35db36a82 in wxDoExecuteWithCapture(wxString const&, wxArrayString&, wxArrayString*, int, wxExecuteEnv const*) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#5  0x00007fe35ebd433f in cbDebuggerPlugin::RunNixConsole(wxString&) ()
   from /home/zyh/code/cbinstall/lib/libcodeblocks.so.0
#6  0x00007fe31ce0ce0a in DebuggerGDB::DoDebug(bool) ()
   from /home/zyh/code/cbinstall/lib/codeblocks/plugins/libdebugger.so
#7  0x00007fe31ce0da5e in DebuggerGDB::Debug(bool) ()
   from /home/zyh/code/cbinstall/lib/codeblocks/plugins/libdebugger.so
#8  0x0000000000473b85 in DebuggerMenuHandler::OnStart(wxCommandEvent&) ()
#9  0x00007fe35d9a45fe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#10 0x00007fe35db2ab32 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#11 0x00007fe35db2abe3 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#12 0x00007fe35db2b32a in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#13 0x00007fe35db2ad73 in wxEvtHandler::DoTryChain(wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#14 0x00007fe35db2b405 in wxEvtHandler::ProcessEvent(wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#15 0x00007fe35dd7d268 in wxWindowBase::TryAfter(wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#16 0x00007fe35db2cb97 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#17 0x00007fe35dd59e64 in wxToolBarBase::OnLeftClick(int, bool) ()
   from /home/zyh/code/wx3install/lib/libwx_gtk3u-3.1.so.1
#18 0x00007fe35a46e5e7 in ?? ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007fe35a487088 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007fe35a488212 in g_signal_emit_by_name ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007fe35a46e5e7 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fe35a487088 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007fe35a487ce2 in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007fe35b7267e8 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#25 0x00007fe35a46e3b8 in g_closure_invoke ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007fe35a47f557 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007fe35a487a29 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#28 0x00007fe35a487ce2 in g_signal_emit ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#29 0x00007fe35b7256a1 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
(More stack frames follow...)
(gdb)


So, it looks like the debugger plugin goes to an endless loop?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blauzahn

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Bootstrap with no wxWidgets packet installed
« Reply #16 on: August 10, 2018, 06:44:31 am »
Code: [Select]
in wxMBConv::ToWChar

Over the last months I have seen cb hanging there reproducibly several times.
And that was from other call-sites -- more than one. If memory serves me, it was e.g. splash-screen
during startup. Right now the latter seems to work. I did not try to analyse it though.

Offline blauzahn

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Bootstrap with no wxWidgets packet installed
« Reply #17 on: August 10, 2018, 06:51:21 am »
Quote
works OK if I run C::B under GDB,

My first thought: Does the debugger set an otherwise uninitialized variable to zero or another
"helpful" value -- maybe just by stack-reuse?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #18 on: August 10, 2018, 08:05:46 am »
@ollydbg: You're most probably hitting a race condition in wxExecute. Search wxwidgets' trac to see if someone has already reported this. I've not seen these for a long time. In the past those happened during compilation.

Also can you try to revert the two recent commits related to the environment in the debugger have anything to do with this?
Can you build wx with symbols so we can see where exactly in their code stops?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #19 on: August 10, 2018, 08:17:43 am »
Also can you try to revert the two recent commits related to the environment in the debugger have anything to do with this?
You mean I just need to revert the svn r11442 and r11441?

Or, the revisions in the debugger plugin? Which revision?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #20 on: August 10, 2018, 09:14:13 am »
Here is the log when I run C::B under GDB, and start the GDB under C::B, it works OK:
Code: [Select]
Active debugger config: GDB/CDB debugger:Default
Selecting target:
Debug
Adding source dir: /home/zyh/code/test/console1/
Adding source dir: /home/zyh/code/test/console1/
Adding file: /home/zyh/code/test/console1/bin/Debug/console1
Changing directory to: /home/zyh/code/test/console1/.
Set variable: LD_LIBRARY_PATH=.::/home/zyh/code/wx3install/lib/

[debug]Command-line: /usr/bin/gdb -nx -fullname -quiet  -args /home/zyh/code/test/console1/bin/Debug/console1
[debug]Working dir : /home/zyh/code/test/console1

Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/zyh/code/test/console1/bin/Debug/console1
Setting SHELL to '/bin/sh'
done

[debug]Reading symbols from /home/zyh/code/test/console1/bin/Debug/console1...
[debug]done.
[debug](gdb)
[debug]> set prompt >>>>>>cb_gdb:

Setting breakpoints

[debug]Using sleep command's PID as console PID 8483, TTY /dev/pts/22
[debug]Queued:[tty /dev/pts/22]
[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1
[debug]Copyright (C) 2014 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-linux-gnu".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.3) 7.7.1

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory /home/zyh/code/test/console1/
[debug]Source directories searched: /home/zyh/code/test/console1:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "/home/zyh/code/test/console1/main.cpp:7"
[debug]Breakpoint 2 at 0x400861: file /home/zyh/code/test/console1/main.cpp, line 7.
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/pts/22
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /home/zyh/code/test/console1/bin/Debug/console1
[debug]Breakpoint 2, main () at /home/zyh/code/test/console1/main.cpp:7
[debug]/home/zyh/code/test/console1/main.cpp:7:56:beg:0x400861
[debug]>>>>>>cb_gdb:

At /home/zyh/code/test/console1/main.cpp:7


While, I see when I start C::B from command line, and start GDB from C::B just hangs, the debug log shows nothing after the line "Setting breakpoints", it sounds like GDB is already started?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #21 on: August 10, 2018, 10:21:32 am »
11415 and 11402
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #22 on: August 10, 2018, 11:56:45 am »
11415 and 11402
OK, I will revert those two commits next week when I'm on Ubuntu.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #23 on: August 15, 2018, 02:44:02 am »
11415 and 11402
OK, I will revert those two commits next week when I'm on Ubuntu.
I just revert those two commits, and I see the hang bug still exists.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #24 on: August 15, 2018, 03:39:02 am »
Can you build wx with symbols so we can see where exactly in their code stops?
I just build a wx library with symbols:
Code: [Select]
mkdir gtk-build-debug
cd gtk-build-debug
../configure --enable-unicode --prefix=/home/zyh/code/wx3install-debug/ --enable-monolithic --enable-debug
make -j4
make install

Then open a terminal, and run such command to let C::B use the new wx library
Code: [Select]
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/zyh/code/wx3install-debug/lib/
./codeblocks --multiply-instance --no-ipc &

Now, I can use C::B to debug. So, this looks like a GCC optimization bug?  ;)
Since I don't rebuild C::B against debug version of wx library.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #25 on: August 15, 2018, 07:28:09 am »
Now, I can use C::B to debug. So, this looks like a GCC optimization bug?  ;)
Hehe, it is so easy to blame the compiler for hard to explain bugs.
GCC is rarely to blame when there are race conditions or other threading bugs...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #26 on: August 15, 2018, 07:30:50 am »
Can you try to build wx from the wx_3_0_branch and see if the problem reproduces?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #27 on: August 15, 2018, 07:53:31 am »
I've just tried to reproduce your setup and debugging works fine when starting cb from terminal.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5055
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Bootstrap with no wxWidgets packet installed
« Reply #28 on: August 15, 2018, 07:55:19 am »
Can you try to build wx from the wx_3_0_branch and see if the problem reproduces?
OK, I will do this soon.
Do I only need to build the wx_3_0_branch library, and use the previous built C::B? I mean I can use the
Code: [Select]
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/somewhere/wx/library/installed
./codeblocks --multiply-instance --no-ipc &
to let C::B pick the wx library.


I have a question, if I have several wx library, such as:
Code: [Select]
/home/zyh/code/wx3install                      release version of wx 3.1.1 library
/home/zyh/code/wx3install-debug            debug version of wx 3.1.1 library
/home/zyh/code/wx30install                   release version of wx 3.0 branch library

How do I adjust the wx-config?
In my previous post, I have to run the command:
Code: [Select]
update-alternatives --install /usr/bin/wx-config wx-config /home/zyh/code/wx3install/bin/wx-config 50which point the wx-config to the wx library before I run the bootstrap command.

I mean, I have to run the update-alternatives command before I build a new C::B?

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Bootstrap with no wxWidgets packet installed
« Reply #29 on: August 15, 2018, 08:16:30 am »
It is better to rebuild the whole codeblocks.

For the wx-config check the help of the cb's configure script. There is an option which allows you to select the exact binary you want to use.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]