Can't save changes made during debug

Sysprogs forums Forums VisualGDB Can't save changes made during debug

This topic contains 13 replies, has 2 voices, and was last updated by  support 3 weeks ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #29587

    wsdx
    Participant

    Hello,

    We’re evaluating VisualGDB now and I can’t understand one thing – need an advise:

    • We downloaded and built c++ project on linux server
    • We installed, configured and run VisualGDB debug of built project in VisualStudio 2017 – it works, ok, breakppoints, step-by-step – everything is okey in this meaning
    • We made some changes in file which debug is working with at the moment
    • Press Ctrl+S (or just Save)
    • VS saves the file locally in some folder like: C:\Users\<username>\AppData\Local\VisualGDB\AutoDownloadedSources\<linux-hostname>\<project-folder>

    But it sends no changes to linux server where project is located. Only locally. Is it possible to commit changes to Linux?

    #29589

    support
    Keymaster

    Hi,

    No problem, we will help you get everything working. In order to get VisualGDB to edit the source files, you would need to import your project into VisualGDB and configure path mapping via the Linux Project Wizard (e.g. to first copy the entire Linux directory to Windows, and then upload modified files during build, or to access all files directly on Linux via SSH).

    Files that are not covered by path mappings will be indeed downloaded to the AutoDownloadedSources folder, but will not be uploaded back.

    If you have configured a path mapping, but the files are still downloaded to the temporary folder, please ensure that the Linux file paths reported by gdb match the paths specified in the mapping. You can find out the gdb-reported paths via a gdb log.

    If nothing helps, please attach your gdb log along with the screenshots of your path mapping settings, and we will help you find the right settings.

    #29590

    wsdx
    Participant

    Thank you very much for help. We will try it tomorrow and let you know.

    #29603

    wsdx
    Participant

    Hello,

    We run project in Visual GDB but have a problem with conditional breakpoints: they are working fine if they are set within a debugging session. But if we relaunch the project, conditional breakpoints are not hit anymore.

    #29604

    wsdx
    Participant

    We also have a problem with our .natvis file. It seems like there is a problem with C casts in .natvis for VisualGDB. Every expression like

    <DisplayString>{*(MyClassImpl*)m_pImpl}</DisplayString>

    is not parsed correctly and classes with such DisplayString are not displayed correctly during debugging, while MyClassImpl is displayed correctly itself.

    #29606

    support
    Keymaster

    No problem, please attach a screenshot of the Help->About VisualGDB window so that we could check for common issues.

    #29609

    wsdx
    Participant

    Hello,
    See in attached file screenshot of the Help->About VisualGDB window

    Attachments:
    You must be logged in to view attached files.
    #29620

    support
    Keymaster

    Thanks, this version should fully support the conditional breakpoints as expected.

    If you could reproduce the breakpoint problem on a smaller project created from scratch, and share the steps for us to reproduce it on our side, we should be able to fix it. Also obtaining a gdb log may provide some extra clues (e.g. gdb might be rejecting breakpoint condition commands).

    Regarding Natvis, please try the {*(::MyClassImpl*)m_pImpl} or {*static_cast<MyClassImpl*>(m_pImpl)} syntax instead.

    #29626

    wsdx
    Participant

    Hello,

    Thanks for your respond!

    1.Regarding breakpoints, I guess the problem is that conditional breakpoint is in the different project (DLL linkage) than the executable project. If I set conditional breakpoint in the executable project, it works fine. Simple breakpoints are working fine everywhere. Here is the log:

    -break-insert -f Source.cpp:343
    &”No source file named Source.cpp.\n”
    ^done,bkpt={number=”4″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”<PENDING>”,pending=”Source.cpp:343″,times=”0″,original-location=”Source.cpp:343″}
    -break-condition 4 numPtsU>100
    ^done
    -break-after 4 0
    ^done
    All created breakpoints are pending. VisualGDB will stop at the entry point.

    -exec-run
    =thread-group-started,id=”i1″,pid=”24159″
    =thread-created,id=”1″,group-id=”i1″
    =library-loaded,id=”/lib/ld-linux.so.2″,target-name=”/lib/ld-linux.so.2″,host-name=”/lib/ld-linux.so.2″,symbols-loaded=”0″,thread-group=”i1″
    ~”Reading symbols from /lib/ld-linux.so.2…”
    ~”Reading symbols from /usr/lib/debug/.build-id/c0/c8b7cefa992f5847b9a621bc0e9c5f96771d13.debug…”
    ~”done.\n”
    ~”done.\n”
    ~”Reading in symbols for rtld.c…”
    ~”done.\n”
    &”Error in re-setting breakpoint 4: No source file named Source.cpp.\n”
    ~”Reading symbols from system-supplied DSO at 0xf7fd7000…”
    ~”(no debugging symbols found)…done.\n”

    ~”Reading in symbols for Source.cpp…”
    ~”done.\n”
    =breakpoint-modified,bkpt={number=”4″,type=”breakpoint”,disp=”keep”,enabled=”n”,addr=”0xf093a0ac”,func=”myFunction()”,file=”Source.cpp”,fullname=”Source.cpp”,line=”343″,thread-groups=[“i1″],cond=”numPtsU>100″,times=”0″,original-location=”Source.cpp:343”}

    I highlighted suspicious parts in bold.

    2.Regarding Natvis, {*(::MyClassImpl*)m_pImpl} works fine, thank you very much (however, static_cast and reinterpret_cast doesn’t work). On the other hand, it would be better if we don’t need to change our natvis files…

    Unfortunately, we met some other problems with natvis:

    <Type Name=”MyObject”>
    <DisplayString>dummy</DisplayString>
    <Expand>
    <Item Name=”dummy”>dummy</Item>
    </Expand>
    </Type>

    <Type Name=”MyClass”>
    <DisplayString>dummy</DisplayString>
    <Expand>
    <Item Name=”MyObject”>m_myObject</Item>
    </Expand>
    </Type>

    While objects of type MyObject are displayed correctly themselves, they are displayed in raw view if they are members of MyClass.

    Another problem is that we use this code to display implementation classes for dozens of different public classes:

    <Type Name=”MyBaseClass”>
    <DisplayString>dummy</DisplayString>
    <Expand>
    <ExpandedItem> * ( ::MyBaseClassImpl* ) m_pImpl </ExpandedItem>
    </Expand>
    </Type>

    This code is not working, expanded fields are blank. However, if I change MyBaseClassImpl to MyDerivedClass1Impl, it starts working (of course, only for MyDerivedClass1Impl, which is derived from MyBaseClassImpl). Here is the log:

    -var-create –frame 0 –thread 1 – * “*(::MyDerivedClass1Impl *)(((*(class MyBaseClass*) this)).m_pImpl)”
    ^done,name=”var21″,numchild=”2″,value=”{…}”,type=”MyDerivedClass1Impl”,thread-id=”1″,has_more=”0″
    ptype/mt MyDerivedClass1Impl
    &”ptype/mt MyDerivedClass1Impl\n”
    ~”type = class MyDerivedClass1Impl : public MyBaseClassImpl {\n”
    ~” protected:\n”
    ~” bool m_myVar;\n”
    ~”}\n”
    ^done
    ptype/mt MyDerivedClass1Impl
    &”ptype/mt MyDerivedClass1Impl\n”
    ~”type = class MyDerivedClas1sImpl : public MyBaseClassImpl {\n”
    ~” protected:\n”
    ~” bool m_myVar;\n”
    ~”}\n”
    ^done
    -var-list-children –simple-values “var21″ 0 2
    ^done,numchild=”2″,children=[child={name=”var21.MyBaseClassImpl”,exp=”MyBaseClassImpl”,numchild=”0″,type=”MyBaseClassImpl”,thread-id=”1″},child={name=”var21.protected”,exp=”protected”,numchild=”1″,value=””,thread-id=”1″}],has_more=”0″
    ptype/mt MyBaseClassImpl
    &”ptype/mt MyBaseClassImpl\n”
    ~”type = class MyBaseClassImpl {\n”
    ~”}\n”
    ^done
    ptype/mt MyBaseClassImpl
    &”ptype/mt MyBaseClassImpl\n”
    ~”type = class MyBaseClassImpl {\n”
    ~”}\n”
    ^done
    -var-list-children –simple-values “var21″ 0 2
    ^done,numchild=”2″,children=[child={name=”var21.MyBaseClassImpl”,exp=”MyBaseClassImpl”,numchild=”0″,type=”MyBaseClassImpl”,thread-id=”1″},child={name=”var21.protected”,exp=”protected”,numchild=”1″,value=””,thread-id=”1″}],has_more=”0″
    ptype/mt MyBaseClassImpl
    &”ptype/mt MyBaseClassImpl\n”
    ~”type = class MyBaseClassImpl {\n”
    ~”}\n”
    ^done
    -var-info-type “var21\.protected”
    ^done,type=””
    ptype/mt
    &”ptype/mt \n”
    &”expected space after format\n”
    ^error,msg=”expected space after format”

    I don’t understand the last error message. Maybe, the problem is in the protected variable?

    Thanks again for your help!

    #29627

    support
    Keymaster

    Unfortunately, as you have not attached the full log, it’s hard to say what exactly is going on. Can you confirm that breakpoint #4 is created with enabled=”y” and then switches to enabled=”n” without VisualGDB issuing any breakpoint-related commands?

    Regarding the second issue, could you please share the example C++ code and specific natvis file so that we could reproduce the issue on our side? Otherwise it’s hard to say what is going on.

    #29629

    wsdx
    Participant

    Hello!

    I’ve attached a full log for the breakpoint problem. I needed to change names of files and directories, but I hope it is not a problem. Breakpoint (#2) is set with enabled=”y” and changes to enabled=”n” for no reason. Also for some reason there is an extra breakpoint (#3) at the beginning of the program that I’ve never set.

    I’ll create a sample program for natvis problem soon.

    Attachments:
    You must be logged in to view attached files.
    #29634

    support
    Keymaster

    Thanks, we have confirmed that gdb indeed unexpectedly disables conditional breakpoints that were set in a shared library prior to its load. As this is a bug in gdb, rather then VisualGDB itself, we can offer one of the following workarounds:

    • You can try enabling all breakpoints by issuing the “enable” command via the GDB Session window after the library has been loaded, or by using the Breakpoints window in Visual Studio.
    • You can also try using Python scripting to respond to breakpoint change events and reenable them.
    • If your company purchases 5 licenses or more (or if the issue starts affecting a customer with 5 or more active licenses), we can add a special workaround to this on the VisualGDB side. The workaround will automatically detect breakpoints that have been disabled by GDB without VisualGDB asking for it, and will manually reenable them. This will imply using the stop-on-solib-events option.
    #29721

    wsdx
    Participant

    Hello!

    Sorry for the long answer. I’ve created a sample project for natvis problems. I am attaching .cpp and .natvis files. I am also attaching a picture with “locals” for regular VS project with MSVC compiler (benchmark) and for VisualGDB project.

    There are two issues:

    1. MyObject and MyClass: MyObject is correctly displayed itself but VisualGDB can’t display it as a part of MyClass (green circle on the image)
    2. MyBaseClass in VisualGDB can’t parse<span style=”color: #0000ff; font-family: Consolas; font-size: small;”><</span><span style=”color: #a31515; font-family: Consolas; font-size: small;”>ExpandedItem</span><span style=”color: #0000ff; font-family: Consolas; font-size: small;”>></span><span style=”font-family: Consolas; font-size: small;”> *(MyBaseClassImpl*)m_impl </span><span style=”color: #0000ff; font-family: Consolas; font-size: small;”></</span><span style=”color: #a31515; font-family: Consolas; font-size: small;”>ExpandedItem</span><span style=”color: #0000ff; font-family: Consolas; font-size: small;”>></span>

      and can’t display m_impl content for correspondent class (red circle on the image). I tried to change <span style=”color: #0000ff; font-family: Consolas; font-size: small;”><span style=”color: #333333; font-family: Georgia; font-size: medium;”>C cast to </span></span>(::MyBaseClassImpl*) or (MyBaseClassImpl1*), still no effect. Only (::MyBaseClassImpl1*) made smth meaningful (see “GDB modified” on the picture). It works for MyBaseClassImpl1 (and only for it) and there are two [Raw View] for some reason. Thus, VisualGDB can’t parse content of the virtual class given the pointer to the base class; also VisualGDB requires :: in C cast, which is not convenient.

    I have one last question: is there a way for two developers to debug simultaniously on the same server?

    Thank you once again for your help.

    Attachments:
    You must be logged in to view attached files.
    #29724

    support
    Keymaster

    Hi,

    According to our records, your trial period has expired. If you would like to get further support, please consider purchasing a license.

    The “::” syntax is a known limitation of the C++ parser used in our Natvis engine. As a workaround, please consider using the “(::Type)(Expression)” or “static_cast<Type *>(Expression)” syntax. As the issue only affects a very small number of users, and the workaround fully solves the problem, we will not be able to change our parser to address it.

    VisualGDB is licensed per seat (computer/user combination). If you would like multiple users to use VisualGDB on the same terminal server, each of them would need a separate license. For your convenience, you can always purchase a multi-seat license key that will get activated on the number of seats you purchased.

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.