Recent Posts

Pages: [1] 2 3 4 5 6 ... 10
1
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by Pecan on Yesterday at 10:00:25 pm »
Hi Pecan,

thank you for the effort.

With the last patch (svn13671 BrowseTracker Move ... ) I get a compile error when building on Linux with make. An include is missing:
Code
#include <logmanager.h>
I don't understand this, logmanager.h is an sdk header, not a BrowseTracker header. It's included in trunk\src\include\Makefile.am Should my include statement use quotes instead of <> brackets?

Quote
When scrolling very briefly through the diff I noticed a function with a suspiciously empty if statement. It looks like unintentional semantics:

Code
void JumpTracker::OnLeftUp(wxMouseEvent& event) {
    if (m_leftDown && (not m_isDragging)) {
        // Pure click (no drag) occurred
    }
    m_leftDown = m_isDragging = false;
    event.Skip();
}
I had removed some old code. I added a comment to make it clearer. But cppcheck won't like it anyway.

Rant: I have never gotten cppcheck to work reliably. It spews out vast amounts of error or warning messages even when the compiler or clangd does not.

Quote
When I run CppCheck over the BrowseTracker cb-project, I get several warnings. E.g.:
Quote
BrowseTrackerLayout.cpp:173:41: warning: Either the condition 'cursor' is redundant or there is possible null pointer dereference: cursor. [nullPointerRedundantCheck]
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^
BrowseTrackerLayout.cpp:155:17: note: Assuming that condition 'cursor' is not redundant
            if (cursor)
                ^
BrowseTrackerLayout.cpp:173:41: note: Null pointer dereference
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^

or
Quote
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_pBrowseTracker' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_menuID' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownCode' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownMods' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^

Besides other warnings.

Since the topic-starter observed a crash, these should be fixed.

Have a nice day.

Those variables were actually initialized, but the code got smushed without white space so that cppcheck didn't recognize it.
I re-formated it to cppcheck taste.

I've changed the "cursor" statement to guard against use of a nullptr. Thanks.

Thanks for looking at this.
2
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by blauzahn on Yesterday at 10:29:25 am »
Hi Pecan,

thank you for the effort.

With the last patch (svn13671 BrowseTracker Move ... ) I get a compile error when building on Linux with make. An include is missing:
Code
#include <logmanager.h>

When scrolling very briefly through the diff I noticed a function with a suspiciously empty if statement. It looks like unintentional semantics:

Code
void JumpTracker::OnLeftUp(wxMouseEvent& event) {
    if (m_leftDown && (not m_isDragging)) {
        // Pure click (no drag) occurred
    }
    m_leftDown = m_isDragging = false;
    event.Skip();
}

When I run CppCheck over the BrowseTracker cb-project, I get several warnings. E.g.:
Quote
BrowseTrackerLayout.cpp:173:41: warning: Either the condition 'cursor' is redundant or there is possible null pointer dereference: cursor. [nullPointerRedundantCheck]
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^
BrowseTrackerLayout.cpp:155:17: note: Assuming that condition 'cursor' is not redundant
            if (cursor)
                ^
BrowseTrackerLayout.cpp:173:41: note: Null pointer dereference
            TiXmlElement* browsemarks = cursor->NextSiblingElement("BrowseMarks");
                                        ^

or
Quote
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_pBrowseTracker' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_menuID' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownCode' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^
BrowseSelector.cpp:93:17: warning: Member variable 'BrowseSelector::m_KeyDownMods' is not initialized in the constructor. Member variables of native types, pointers, or references are left uninitialized when the class is instantiated. That may cause bugs or undefined behavior. [uninitMemberVarPrivate]
BrowseSelector::BrowseSelector()
                ^

Besides other warnings.

Since the topic-starter observed a crash, these should be fixed.

Have a nice day.
3
Help / Re: Debugging problem in a console application with ncurses library
« Last post by Bug Killer on June 21, 2025, 03:25:31 pm »
It appears that by default C::B runs a console application in a xterm terminal. If xterm is not installed the program is not displayed.

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/cdf24/Documents/CodeBlocks/nctest/
Adding source dir: /home/cdf24/Documents/CodeBlocks/nctest/
Adding file: /home/cdf24/Documents/CodeBlocks/nctest/bin/Debug/nctest
Changing directory to: /home/cdf24/Documents/CodeBlocks/nctest/.
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/cdf24/Documents/CodeBlocks/nctest/bin/Debug/nctest
Setting SHELL to '/bin/sh'
done
Setting breakpoints
Failed to execute terminal command: 'xterm -T 'Program Console' -e sleep 80012477' (exit code: -1)
Debugger name and version: GNU gdb (AlmaLinux) 14.2-4.el9
At /home/cdf24/Documents/CodeBlocks/nctest/main.cpp:9
Continuing...

You can change the default terminal for gnome-terminal in the drop list.

The message "warning: GDB: Failed to set controlling terminal: Operation not permitted" can be safely ignored.
4
Help / Re: Debugging problem in a console application with ncurses library
« Last post by Krice on June 21, 2025, 12:48:31 pm »
It's even easier if you run gdb from the command line, but you need to copy data files etc. to where the executable file is, if it needs them (or set the working directory from gdb I guess). I can run gdb from command line and debug the program that way, I'm just wondering if it's even possible to debug ncurses programs within Code::Blocks. It has to be some kind of gdb issue, because running without gdb works. It's a mess. I don't know why TERM=xterm removes the error message when running, but doesn't show the executable's console window.
5
Help / Re: Debugging problem in a console application with ncurses library
« Last post by Bug Killer on June 21, 2025, 12:25:09 pm »
The best way I know to debug a ncurses program is to start it with gdbserver then debug it with gdb as a remote target. So, I have the ncurses program on a terminal and debuging on another.

First terminal :

Code
$ gdbserver myprogram localhost:1234
Second temminal :

Code
$ gdb -tui myprogram
(gdb) target remote localhost:1234
(gdb)
6
Help / Binary releases page has broken sourceforge links
« Last post by NooneAtAll3 on June 21, 2025, 05:07:25 am »
Check what links are at https://www.codeblocks.org/downloads/binaries/

Non-exe options link to correct file name, but incorrect file extension (e.g. https: ... /codeblocks-25.03mingw-nosetup.exe)

Following such incorrect link results in project's sourceforge page with "pop-up" error about not finding that file

Changing the link to "...-nosetup.zip" fixes the issue
7
Dunno if this should go into Help subforum, but this isn't about C::B, but about this forum

Registration asks "digits of last year in reverse order", but it did not accept previous year when I tried - accepting current year instead
8
Using Code::Blocks / Re: CB 25.02 - BrowseTracker crash on startup
« Last post by Pecan on June 20, 2025, 06:14:43 pm »
I cannot reproduce this problem.

Is this actually on Windows 10?
Please tell us the OS your using, and exactly how you installed CodeBlocks on that system so I can try to re-produce the steps that caused the error.

SideNote: both Addr2Line and (gdb) Info Line show "No statements found" at the BrowseTracker addresses from the crash report. And spending 4 hours trying to guess where in OnAttached() this occured produced no results.
9
Help / Re: Debugging problem in a console application with ncurses library
« Last post by Krice on June 20, 2025, 12:38:08 pm »
It seems like you need to add envinronment variable for (any) IDE which is TERM=xterm so I did that (Settings-environment-environment variables) and now the debugger runs, but it doesn't open a terminal window of the program, it's like the program just runs in the background somewhere (alt+tab doesn't show it either). Someone had fixed this in Eclipse by enabling "Use external console for inferior (open a new console window for input/output)". Is this possible in Code::Blocks, to open an "external" console window?
10
Help / Re: Cppcheck settings?
« Last post by Krice on June 20, 2025, 12:07:51 pm »
You can add these flags in settings|environment|CppCheck/Vera++|CppCheck arguments.

Right, the settings were there.. I tried to find it from Editor settings. Thanks, now it works.
Pages: [1] 2 3 4 5 6 ... 10