-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Debugger: corrupted double-linked list #12945
Comments
@Sving1024 This sounds like a gdb bug. I think you would need to file a bug on gdb. |
@Sving1024 Or do you believe it's a bug in MIEngine? I'm not sure if MIEngine could cause such a gdb crash. |
@Sving1024 There's a similar issue at microsoft/MIEngine#968 you may want to refer to. |
I met the same problem with vsc-cpp. But when I use gdb manually there is no such problem. |
@Eletary Sure, if that's the case, then it sounds like a bug from our extension/MIEngine. |
It seems the issue is related to #include <iostream>
#include <queue>
using namespace std;
using ll = long long;
using ull = unsigned long long;
struct location {
ll x, y;
location() { x = y = 0; }
location(ll _x, ll _y) : x(_x), y(_y) {}
location operator+(const location &b) const {
return location(x + b.x, y + b.y);
}
location operator*(const ll &k) const { return location(x * k, y * k); }
location operator/(const ll &k) const { return location(x / k, y / k); }
};
struct node {
location l;
ll val;
bool operator<(const node &b) const { return val > b.val; }
};
int main(){
priority_queue<node> q;
for (ll i=0;i<5;i++) {
ll x,y,z;
cin>>x>>y>>z;
q.push({{x,y},z});
}
cout<<(q.top().l.x);
} use input(from keyboard):
If you redirect from a file, gdb crashes with a corrupted double-linked list initially, not even hitting the breakpoint at line 26. With proper inputs (at least 5 integers in the input), the program works well. However, in a more complex program(you can find that in the attachment), gdb will crash as soon as it starts whether the input is from the keyboard or redirected from a file. #include <iostream>
#include <queue>
using namespace std;
using ll = long long;
using ull = unsigned long long;
struct test2{
ll x,y;
};
struct test{
ll x;
test2 t;
test(ll _x){
x=_x;
}
~test(){
cout<<"rm obj\n";
return;
}
bool operator<(const test& b)const{return x<b.x;}
};
int main(){
priority_queue<test> q;
for (ll i=0;i<5;i++) {
ll x;
cin>>x;
q.push({x});
}
cout<<(q.top().x);
} using |
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
Sometimes when I start to debug a cpp file, gdb crashes with "corrupted double-linked list". That seems to happen randomly, and usually disappear after a restart or rebuild.
Steps to reproduce:
Debugger Configurations
launch.json:
Debugger Logs
Other Extensions
core.gdb.1000.0decefcddda24410bcd734a899f90617.44048.1731160247000000.zip
Additional Information
No response
The text was updated successfully, but these errors were encountered: