Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect display of data on the stack when debugging C++ with QObject #1199

Open
SeeGeK opened this issue Dec 26, 2024 · 0 comments
Open

Incorrect display of data on the stack when debugging C++ with QObject #1199

SeeGeK opened this issue Dec 26, 2024 · 0 comments

Comments

@SeeGeK
Copy link

SeeGeK commented Dec 26, 2024

OS: 5.15.0-125-generic #135~20.04.1-Ubuntu SMP Mon Oct 7 13:56:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
VSCode version: 1.95.3
CodeLLDB version: 1.11.1
Compiler: GCC 9.4.0 x86_64-linux-gnu
Debuggee: x86_64 bynaryexecutable

When debugging a C++ project using Qt, LLDB shows trash
If the class is inherited from QObject and the implementation of the destructor is transferred to a *.cpp file, then lldb “breaks” and displays trash

holder.h

#include <QObject>
struct Holder : public QObject
{
public:
   ~Holder() override;
private:
   std::vector<int> targets2_ = {1,2,3};
   std::vector<int> targets_;
};

holder.cpp

#include <holder.h>
Holder::~Holder() {}

main.cpp

#include "holder.h"

int main() 
{
  Holder holder;
  return 0;
}

In this case, the stack on main.cpp:6 (return 0) looks like this:

bug_1
bug_2

targets2_ contains 128 elements, although it is initialized with only three ({1,2,3})

If the destructor is moved to holder.h

holder.h

#include <QObject>
struct Holder : public QObject
{
public:
   ~Holder() override = default;
private:
   std::vector<int> targets2_ = {1,2,3};
   std::vector<int> targets_;
};

then the stack looks good

ok

This behavior appeared in CodeLLDB version 1.11.0; in version 1.10.0, the stack always looks good.

LLDB output: lldb-log.txt

An example project can be found here: lldb-bug-repr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant