Forum Replies Created
-
AuthorPosts
-
elikfirParticipant
I tried to use this page and it doesn’t help.
I debug the LinuxAppLauncher and it looks like the issue is that WSL doesn’t allow it to connect via port 64526, and it stuck. when use port 139 which open to TCP protocol it finish the execution of this app with:
Launching docker, pty=0…
argv[0] = …
argv[1] = …
…DISPLAY = :10
Waiting for the target process PID…
Target process PID: 6718
Forwarding output…
Mismatching initialization packet (size=-1, type=81, payload=0)
Reporting exit code (0)I’m using Win11. The IP address is correct.
I don’t know if it’s OK, but if yes, how can I configure VisualGDB to use different port than 64526? (forcing the app to use this port doesn’t help)
Or maybe, how can I allow windows to let this APP to listen on this port? firewall changes doesn’t help.
thanks
elikfirParticipantthanks,
I use Windows with WSL2, so I don’t know if it’s related or not.
this raised another issue I have – I didn’t managed to connect to WSL Ubuntu20.04 by VisualGDB (it stuck while trying to connect). In order to connect I have to run sshd on the Ubuntu side and on VisualGDB I use SSH stack instead of other connection to WSL (I don’t know what’s it).
this bother me because the IP has changed after every reboot and I need to update the local DNS (system32\drivers\etc\hosts) with the new IP. do you have any clue why is that?
elikfirParticipantok, Now I’m able to reproduce the issue without visualGDB.
thanks
elikfirParticipantI tried to reproduce the issue outside the visualGDB and it works fine. I actually run every command that VisualGDB sent.
elikfirParticipantthanks 🙂
elikfirParticipantHi,
the changes you made for me (starting from the the new version) cause that I cannot see simple classes like (even without -enable-pretty-printing flag):class A
{
public:
int32_t a = 1;
};
class B : public A
{
public:
int32_t b = 2;
};
int main()
{
B b;
return 0;
}
the error I got:
<sub>
-var-create --frame 0 --thread 1 - * "b"
</sub>
<sub>^done,name="var5",numchild="2",value="{...}",type="B",thread-id="1",has_more="0"
</sub>
<sub>ptype/mt B
</sub>
<sub>&"ptype/mt B\n"
</sub>
<sub>type = class B : public A {
</sub>
<sub>public:
</sub>
<sub>int32_t b;
</sub>
<sub>}
</sub>
<sub>OK
</sub>
<sub>-var-list-children --simple-values "var5"
</sub>
<sub>^done,numchild="2",children=[child={name="var5.A",exp="A",numchild="1",type="A",thread-id="1"},child={name="var5.public",exp="public",numchild="1",value="",thread-id="1"}],has_more="0"
</sub>
<sub>ptype/mt A
</sub>
<sub>&"ptype/mt A\n"
</sub>
<sub>type = class A {
</sub>
<sub>public:
</sub>
<sub>int32_t a;
</sub>
<sub>}
</sub>
<sub>OK
</sub>
<sub>-var-info-type "var5\.public"
</sub>
<sub>^done,type=""
</sub>
<sub>ptype/mt
</sub>
<sub>&"ptype/mt \n"
</sub>
<sub>&"expected space after format\n"
</sub>
<sub>expected space after format</sub>
with the old version (5.6) it works. here is the log of 5.6:
<sub>-var-create –frame 0 –thread 1 – * “b”</sub>
<sub>^done,name=”var4″,numchild=”2″,value=”{…}”,type=”B”,thread-id=”1″,has_more=”0″</sub>
<sub>ptype/mt B</sub>
<sub>&”ptype/mt B\n”</sub>
<sub>type = class B : public A {</sub>
<sub>public:</sub>
<sub>int32_t b;</sub>
<sub>}</sub>
<sub>OK</sub>
<sub>ptype/mt B</sub>
<sub>&”ptype/mt B\n”</sub>
<sub>type = class B : public A {</sub>
<sub>public:</sub>
<sub>int32_t b;</sub>
<sub>}</sub>
<sub>OK</sub>
<sub>-var-list-children –simple-values “var4″ 0 2</sub>
<sub>^done,numchild=”2″,children=[child={name=”var4.A”,exp=”A”,numchild=”1″,type=”A”,thread-id=”1″},child={name=”var4.public”,exp=”public”,numchild=”1″,value=””,thread-id=”1″}],has_more=”0″</sub>
<sub>ptype/mt A</sub>
<sub>&”ptype/mt A\n”</sub>
<sub>type = class A {</sub>
<sub>public:</sub>
<sub>int32_t a;</sub>
<sub>}</sub>
<sub>OK</sub>
<sub>ptype/mt A</sub>
<sub>&”ptype/mt A\n”</sub>
<sub>type = class A {</sub>
<sub>public:</sub>
<sub>int32_t a;</sub>
<sub>}</sub>
<sub>OK</sub>
<sub>-var-evaluate-expression “var4\.A”</sub>
<sub>^done,value=”{…}”</sub>
<sub>-var-list-children –simple-values “var4\.public” 0 1</sub>
<sub>^done,numchild=”1″,children=[child={name=”var4.public.b”,exp=”b”,numchild=”0″,value=”2″,type=”int32_t”,thread-id=”1″}],has_more=”0″</sub>
<sub>ptype/mt int32_t</sub>
<sub>&”ptype/mt int32_t\n”</sub>
<sub>type = int</sub>
<sub>OK</sub>
<sub>ptype/mt int32_t</sub>
<sub>&”ptype/mt int32_t\n”</sub>
<sub>type = int</sub>
<sub>OK</sub>
<sub>-stack-list-frames –thread 1</sub>
<sub>^done,stack=[frame={level=”0″,addr=”0x0000555555401236″,func=”main”,file=”../../../Source.cpp”,fullname=”/home/nvidia/.vs/Project3/Source.cpp”,line=”29″}]</sub>
<sub>-stack-list-arguments –thread 1 0</sub>
<sub>^done,stack-args=[frame={level=”0″,args=[]}]</sub>
<sub>-var-list-children –simple-values “var4\.A” 0 1</sub>
<sub>^done,numchild=”1″,children=[child={name=”var4.A.public”,exp=”public”,numchild=”1″,value=””,thread-id=”1″}],has_more=”0″</sub>
<sub>-var-list-children –simple-values “var4\.A\.public” 0 1</sub>
<sub>^done,numchild=”1″,children=[child={name=”var4.A.public.a”,exp=”a”,numchild=”0″,value=”1″,type=”int32_t”,thread-id=”1″}],has_more=”0″</sub>
<sub>ptype/mt int32_t</sub>
<sub>&”ptype/mt int32_t\n”</sub>
<sub>type = int</sub>
<sub>OK</sub>I guess the problem is unhandled exception which throw on ptype/mt without and data type for var5.public
thanks
- This reply was modified 3 years ago by elikfir.
elikfirParticipantthanks, it works (and now gdb8.1 doesn’t crash)
Regarding python – it’s fine to have it on “Additional GDB commands”. another option which will help other users is if you can add a bottom beside “Enable GDB-level pretty printing” to auto load that and a text box about the location of the gdb shared folder. You can also offer a default value according to what you find on the Linux machine (on my Linux I have one version of gcc, and I guess in most users this is the case). if it’s not correct user can change the path accordingly (as you have in “Debug Settings” tab which you let user to configure gdb path and gdb launch command line in fully custom option). it’s a good hint about issue and save users time googling it.
elikfirParticipantHi,
thanks for the drop, finally I can see std::unordered_map/set.
two comments here:- the call -var-info-path-expression “var2\.\[3\]” crashed on GDB 8.11 and close debugging. on GDB 11 it just failed with “Invalid variable object (child of a dynamic varobj)“
- when using GDBServer or when replacing GDB, the pretty printer of libstdcxx isn’t loaded and we need to manually load it (it’s a common issue on vscode as well). in order to do that we need to run:
“python import sys;sys.path.insert(0, ‘/usr/share/gcc-8/python’);from libstdcxx.v6.printers import register_libstdcxx_printers;register_libstdcxx_printers(None)“
the log of the crash is:
/build/gdb-veKdC1/gdb-8.1.1/gdb/c-varobj.c:887: internal-error: void cplus_describe_child(const varobj*, int, std::__cxx11::string*, value**, type**, std::__cxx11::string*): Assertion `access’ failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)thanks 🙂
Eli
elikfirParticipantthe difference between VS (and vscode also) to visualGDB is the gdb command – “-enable-pretty-printing”. once I add it to VisualGDB GDBSession I can see the correct data when calling to relevant MI commands:
-var-create –frame 0 –thread 1 – * “m”
^done,name=”var9″,numchild=”0″,value=”{…}”,type=”std::unordered_map<int, float, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, float> > >”,thread-id=”1″,displayhint=”map”,dynamic=”1″,has_more=”1″
-complete “-var-list-children –simple-values “var9″
Undefined MI command: complete”,code=”undefined-command
-var-list-children –simple-values “var9″
^done,numchild=”2″,displayhint=”map”,children=[child={name=”var9.[0]”,exp=”[0]”,numchild=”0″,value=”5″,type=”const int”,thread-id=”1″},child={name=”var9.[1]”,exp=”[1]”,numchild=”0″,value=”5.0999999″,type=”float”,thread-id=”1″}],has_more=”0″see full log attached.
the problem is now I cannot see anything in the watch (even not simple std::string) because visualGDB get it with a different format than a RAW data. all the classes looks like – “m : {}”. I geuss this happen also because VisualGDB doesn’t call to ‘-var-list-children” to retrieve values and count on the “value” property on the “-var-create” call which is empty due to an old GDB bug.
Attachments:
You must be logged in to view attached files.elikfirParticipantI can validate it on simple command line that MI mode doesn’t contain the data from the pretty printer. it looks like a GDB bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=25153
interesting that VS2022 native debugger get over that
- This reply was modified 3 years ago by elikfir.
elikfirParticipantdisabling verbose log doesn’t help.
here is the output from command window (that’s the way to communicate with GDB)>Debug.MIDebugExec -var-create –frame 0 –thread 1 – * “m”
result-class: done
name: var22
numchild: 0
value: {…}
type: std::unordered_map<int, float, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, float> > >
thread-id: 1
displayhint: map
dynamic: 1
has_more: 1Debug.MIDebugExec -var-list-children –simple-values “var22”
result-class: done
numchild: 2
displayhint: map
children: [child={name=var22.[0],exp=[0],numchild=0,value=5,type=const int,thread-id=1},child={name=var22.[1],exp=[1],numchild=0,value=5.0999999,type=float,thread-id=1}]
has_more: 0here is from Visual GDB Session window:
-var-create –frame 0 –thread 1 – * “m”
^done,name=”var33″,numchild=”1″,value=”{…}”,type=”std::unordered_map<int, float, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, float> > >”,thread-id=”1″,has_more=”0″
-var-list-children –simple-values “var33″
^done,numchild=”1″,children=[child={name=”var33.private”,exp=”private”,numchild=”1″,value=””,thread-id=”1″}],has_more=”0″same thing I get when I enabled verbose on native VS debugger:
>Debug.MIDebugExec -var-list-children –simple-values “var22”
result-class: done
numchild: 1
children: [child={name=var22.private,exp=private,numchild=1,value=,thread-id=1}]
has_more: 0>Debug.MIDebugExec p m
$1 = std::unordered_map with 1 element = {[5] = 5.0999999}- This reply was modified 3 years ago by elikfir.
elikfirParticipanthere is the summary:
the code is:#include <iostream>
#include <unordered_map>int main()
{
std::unordered_map<int32_t, float> m;
m[5] = 5.1f;
int c = getchar();
return 0;
}Visual Studio debugging without any change to the configuration – works fine and I can see the data on the watch.
Visual Studio debugging with adding verbose log to the launch.vs.json – same behavior as Visual GDB – I can see the data on the GDB command line only but not in the watch.
VisualGDB – as mentioned – I can see the data on command line after manually loading pretty-printing for libgcc but not on the watch.
this is the way I added verbose to the configuration:
“setupCommands”: [
{
“description”: “verbose”,
“text”: “set verbose on”,
“ignoreFailures”: true
}
]Attachments:
You must be logged in to view attached files.elikfirParticipantbut here my question is different – the data is already there when using pretty-printer, is there any simple step that I can do to see it on the watch? (VS2022 native Linux debugger has it)
elikfirParticipantHi,
yes, that’s what I did (or a better way to put it on additional gdb commands part).
But I want to see it on the watch window. I don’t want to go back to use command line GDB, that’s why I purchased VisualGDB
elikfirParticipantI just found a way to get it print correctly when using VS2022 (by using libstdcxx pretty printing). it works fine when using native VS2022 Linux debugger.
It doesn’t work on VisualGDB, I can see the values on GDB Session window but not on the Watch.
Is there any way to enable it on the watch as it’s done on native Linux debugger on VS2022?
-
AuthorPosts