Sysprogs forums › Forums › VisualGDB › Path mapping that contain symlinks
- This topic has 7 replies, 2 voices, and was last updated 8 years, 5 months ago by support.
-
AuthorPosts
-
July 3, 2016 at 19:46 #8518BitFlipperParticipant
Hi,
My Linux project is built on a different host and then deployed to a debug host. However all of this happens outside of VGDB, so I only need VGDB to do the debugging, nothing else.
The build folder is mounted to the debug host so that the source code can be mapped 1:1 on the debug host. It is also mounted on the Windows box and this mapping is configured within VGDB. For this example, say the path on the build host is /src/myproject/, and on Windows it is C:\src\myproject\
However the problem is that on the debug host, the actual path is a symlink to a different folder on the debug host. So the following path on the host would resolve to something like this:
/src/myproject -> /some/other/path/GUID/myproject
When I enter the path mapping in VGDB as /src/myproject -> C:\src\myproject, VGDB cannot map the sources properly and instead downloads the source file into it’s cache (which makes dev/debugging difficult as I would often accidentally try to edit the cached version of the file).
However when I enter the path mapping in VGDB as /some/other/path/GUID/myproject -> C:\src\myproject, then VGDB can successfully map the source files and doesn’t download the source files into the cache. However the path containing the GUID can vary over time (although the symlink would always have the correct path) so it isn’t ideal to use it.
Is there a way to make VGDB resolve paths containing symlinks properly?
July 4, 2016 at 03:54 #8519supportKeymasterHi,
You can solve this in 2 steps:
- Create a custom pre-debug action that will query the current GUID value and store it in a VisualGDB variable
- Use the variable (e.g. $(MyGUID)) in the path mapping in VisualGDB Project Properties
Let us know if you need further details.
July 4, 2016 at 17:36 #8522BitFlipperParticipantThanks for your help, it sounds like a solution to the problem.
However can you give me an example of how to store a value into a VGDB variable programmatically? I searched around but did not find an example.
July 6, 2016 at 04:37 #8525supportKeymasterHi,
Sure, please open VisualGDB Project Properties, go to the Custom Debug Steps page, find Pre-Debug action list, click “Edit” and then add an action like this:
Then you can simply reference $(TestVar) from your path mappings in VisualGDB Project Properties.
July 6, 2016 at 17:55 #8529BitFlipperParticipantExcellent, thanks! I’ll give it a try.
July 6, 2016 at 21:25 #8530BitFlipperParticipantI can’t get this to work properly. I’ve tried adding the custom action to “Custom build steps”, “Custom debug steps” and also as a “Custom shortcut”. In all 3 cases, when I click on the “Test command now” button, I get the following popup dialog:
Success:
TestVar=/the/correct/pathSo the command is working properly for 3 of the above ways of configuring it. However the path mapping still does not work.
So for clarification, should the variable that I’m setting be a pre-existing variable (TestVar in this example)? I tried both with a non-existent variable, as well as a pre-existing user variable and it never works, unless I manually set the user variable to the correct value.
Also, I noticed that if I don’t create a pre-existing variable, it never shows up in the “View VGDB variables” window, even after successfully running the command.
Any idea what I’m doing wrong?
July 7, 2016 at 19:39 #8536BitFlipperParticipantBTW, the ideal way that I want this to work is as follows:
I already have a custom shortcut that I run once for each new debug host. It performs a bunch of operations like copy config files, mounts various shares to the debug host etc. I’d like to add another step to this shortcut that sets the user variable to the correct value for the particular path on the debug host. So basically, once I run that shortcut and it performs all the steps, the user variable should be set to the correct value, and I should see it in the list of user variables.
But as mentioned in the previous reply, I can’t get this to work. Please let me know what I’m doing wrong.
July 8, 2016 at 02:49 #8540supportKeymasterHi,
The command should be placed in the “Before launching GDB” list. Then the command will be launched each time you debug and will set the variable for the duration of the debugging session.
Here are the relevant parts of the .vgdbsettings file:
<?xml version="1.0"?> <VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ConfigurationName>Debug</ConfigurationName> <Project xsi:type="com.visualgdb.project.linux"> <CustomSourceDirectories> <Directories> <SourceDirMappingEntry> <RemoteDir>$(DirName)</RemoteDir> <LocalDir>e:\temp</LocalDir> </SourceDirMappingEntry> </Directories> <PathStyle>RemoteUnix</PathStyle> <LocalDirForAbsolutePaths /> <LocalDirForRelativePaths /> </CustomSourceDirectories> <CustomDebug> <PreDebugActions> <CustomActionBase xsi:type="SetVariableFromCommandAction"> <SkipWhenRunningCommandList>false</SkipWhenRunningCommandList> <RemoteHost> <HostName>BuildMachine</HostName> <Transport>BuiltinShortcut</Transport> <UserName /> </RemoteHost> <Command>echo</Command> <Arguments>/tmp</Arguments> <WorkingDirectory>$(BuildDir)</WorkingDirectory> <Environment> <Records /> </Environment> <VariableName>DirName</VariableName> <RegularExpression>(.*)</RegularExpression> </CustomActionBase> </PreDebugActions> <PostDebugActions /> <DebugStopActions /> <BreakMode>Default</BreakMode> </CustomDebug> </VisualGDBProjectSettings2>
If this does not help, please send us your .vgdbsettings file so that we could check what is wrong with it.
-
AuthorPosts
- You must be logged in to reply to this topic.