C++ & vimspector & -exec -enable-pretty-printing - vim

Currently I have to enter -exec -enable-pretty-printing into vimspector debugger command line (debugging C++ code using vscode-cpptools) to see std::string as a "string" rather than as a STL container. Could you advice me how to modify my .vimspector.json to run the command automatically on vimspector launch? I tried to google it out but without success... My current .vimspector.json looks like this.
{
"configurations": {
"Vim - run a test": {
"adapter": "vscode-cpptools",
"configuration": {
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/main",
"args": [
"-enable-pretty-printing"
],
"cwd": "${workspaceRoot}",
"environment": [
{ "name": "VIMRUNTIME", "value": "${workspaceRoot}" }
],
"externalConsole": true,
"stopAtEntry": true,
"MIMode": "gdb",
"logging": {
"engineLogging": false
}
}
}
}
}
Thx,
Michal
PS: The mentioning -enable-pretty-printing as argument in .json file does not work.

OK, I have installed vscode and had a look at its configuration files. It seems that the following .vimspector.json file does what I want.
{
"configurations": {
"FinMat": {
"adapter": "vscode-cpptools",
"configuration": {
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/main",
"args": [],
"cwd": "${workspaceRoot}",
"environment": [
{ "name": "VIMRUNTIME", "value": "${workspaceRoot}" }
],
"externalConsole": true,
"stopAtEntry": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"logging": {
"engineLogging": false
}
}
}
}
}

Related

Error while using Visual Studio Code for remote debugging python code

MacOS: 10.15.6
Visual Studio Code: 1.49.1
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"logToFile": true,
"justMyCode": false,
"outputCapture": "std",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
]
}
Docker Command
docker run --name faber --rm -it
-p 0.0.0.0:8020-8027:8020-8027 -p 8028:8028
.......
Visual Studio Code log file
0 Starting Session:
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"logToFile": true,
"justMyCode": false,
"outputCapture": "std",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python",
"remoteRoot": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python"
}
],
"debugOptions": [
"DebugStdLib",
"RedirectOutput",
"UnixClient",
"ShowReturnValue"
],
"showReturnValue": true,
"workspaceFolder": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python"
}
1 Client --> Adapter:
{
"command": "initialize",
"arguments": {
"clientID": "vscode",
"clientName": "Visual Studio Code",
"adapterID": "python",
"pathFormat": "path",
"linesStartAt1": true,
"columnsStartAt1": true,
"supportsVariableType": true,
"supportsVariablePaging": true,
"supportsRunInTerminalRequest": true,
"locale": "en-us",
"supportsProgressReporting": true
},
"type": "request",
"seq": 1
}
3 Error:
{}
5 Client --> Adapter:
{
"command": "disconnect",
"arguments": {
"restart": false
},
"type": "request",
"seq": 2
}
6 Error:
{
"code": "EPIPE"
}
2508 Stopping Session
As shown in the log file above I get and EPIPE error. Also the debugger does not attach to the remote docker process. Please could someone help what this error is about. Thank you.
I had the same problem when I let the debugger to listen on localhost inside the container instead of 0.0.0.0 like:
python -m debugpy --listen localhost:5678 myfile.py
Running it on 0.0.0.0 resolved the problem:
python -m debugpy --listen 0.0.0.0:5678 myfile.py

How to configure and build VSCode with Omnipascal and Delphi

I have two problems.
The first is related with dfm form design preview.
Not work. I will try to simulate error message for more info. Before that I need to setup configuration due to the buld error:"Missig Form Unit".
Let start this amazing post with many different configuration. All the stuff are referring for Delphi and Omnipascal.
C:\Users\My-PC\AppData\Roaming\Code\User\settings.json
{
"window.zoomLevel": -0.3862065056838846,
"workbench.colorTheme": "Visual Studio 2019 Dark",
"editor.tabSize": 2,
"git.confirmSync": false,
"projectManager.git.baseFolders": [
],
"files.associations": {
"*.pas": "pascal"
},
"editor.fontFamily": "'Courier New', 'Courier New Cyr', Consolas, monospace, '#MS Gothic'",
"editor.wordWrapColumn": 200,
"editor.fontSize": 13,
"editor.scrollbar.verticalScrollbarSize": 10,
"GLOBAL": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"global": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"GTAGSCONF": "C:\\gnu\\glo653wb\\share\\gtags\\gtags.conf",
"GTAGSLABEL": "pygments",
"workbench.iconTheme": "material-icon-theme",
"files.encoding": "windows1251",
"omnipascal.defaultDevelopmentEnvironment":"Delphi",
"objectpascal.delphiInstallationPath":"C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source",
"omnipascal.delphiInstallationPath": "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source",
"omnipascal.searchPath": "D:\\Borland\\*;$(DELPHI)\\Lib;$(DELPHI)\\Bin;$(DELPHI)\\Imports;$(DELPHI)\\Projects\\Bpl;$(DELPHI)\\Rave5\\Lib;C:\\Program Files (x86)\\Embarcadero\\F\\Dcu\\D7;C:\\Program Files (x86)\\Embarcadero\\F\\Source;C:\\Program Files (x86)\\FTrial\\LIBD7;D:\\Borland\\Delphi7\\Projects\\Indy10\\Core;D:\\Borland\\Delphi7\\Projects\\Indy10\\Protocols;D:\\Borland\\Delphi7\\Projects\\Indy10\\SuperCore;D:\\Borland\\Delphi7\\Projects\\Indy10\\System;$(DELPHI)\\source\\vcl;$(DELPHI)\\Source\\Rtl;$(DELPHI)\\source\\rtl\\Corba45;$(DELPHI)\\source\\rtl\\Sys;$(DELPHI)\\source\\rtl\\Win;$(DELPHI)\\source\\rtl\\common;$(DELPHI)\\source\\Internet;$(DELPHI)\\source\\clx;$(DELPHI)\\source\\websnap;$(DELPHI)\\Source\\WebMidas;$(DELPHI)\\Source\\Indy;$(DELPHI)\\Source\\IntraWeb;$(DELPHI)\\Source\\Samples;$(DELPHI)\\Source\\Soap;$(DELPHI)\\Source\\ToolsAPI;$(DELPHI)\\Source\\Xml;C:\\Program Files (x86)\\Embarcadero\\S;C:\\Program Files (x86)\\rial\\LID7;",
"omnipascal.msbuildPath": "C:\\Users\\-PC\\.vscode\\extensions\\ms-dotnettools.csharp-1.22.1\\.omnisharp\\1.35.3\\.msbuild\\Current\\Bin\\",
"omnipascal.createBuildScripts": true,
"pascal.formatter.enginePath": "D:\\DWN\\prog\\jcf_243_exe\\JCF.exe",
"pascal.formatter.engineParameters": "D:\\DWN\\prog\\jcf_243_exe\\JCFSettings.cfg",
"pascal.format.wrapLineLength": 30000,
"pascal.formatter.engine": "jcf",
"editor.rulers": [
],
"editor.minimap.enabled": false,
"editor.renderControlCharacters": true,
}
D:\Git\develop.vscode\tasks.json
{
// See https://go.mic.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Delphi",
"type": "shell",
"windows": {
"command": "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\bin\\DCC32.EXE"
},
"presentation": {
"reveal": "always",
"panel": "new"
},
"args": [
{
"value": "D:\\Git\\develop\\Ere\\Eore.dpr",
"quoting": "escape"
}
],
"problemMatcher": {
"owner": "external",
"pattern": {
"regexp": "^(.*.(pas|dpr|dpk))\\((\\d+)\\)\\s(Fatal|Error|Warning|Hint):(.*)",
"file": 1,
"location": 3,
"message": 5
}
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
https://github.com/alefragnani/vscode-language-pascal#code-navigation
GNU Global 6.5 or higher (http://www.gnu.org/software/global/global.html)
Exuberant Tags 5.5 or higher (http://ctags.sourceforge.net/)
Python 2.7 or higher (https://www.python.org/)
Python Pygments (via pip install Pygments)

How to merge JSON files in Sublime Text

Currently I'm using a custom task.json file to compile and run C and C++ code in Linux:
{
"version": "2.0.0",
"tasks": [
{
"label": "PIYUSH Compiler",
"type": "shell",
"command": "g++",
"args": [
"-g",
"${relativeFile}",
"-o",
"${fileBasenameNoExtension}.out",
"&&",
"clear",
"&&",
"./${fileBasenameNoExtension}.out"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
]
}
Now there is a build file from Sublime text:
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "python3 /home/piyush/Documents/CPHelper/Main.py\"${file_path}/${file_base_name}\""
}
]
}
I want a JSON file to merge both my custom task.json file and this Sublime Text build file in a single task.json file.
How to do it?

VSTS fabrikam-build-extension sample not working (Template)

Just tried the fabrikam-build-extension sample on TFS 2017 and VSTS. I can see the custom tasks modifying a build, but I'm unable to use the Template1 Template to create a build definition. Template1 isn't listed.
Anybody have a clue?
Yes, I can reproduce the issue. The two tasks can be add successfully. But the template1 can’t be added in VSTS build template.
But If I use the same content as template.json to create a build template by REST API, I can find it in build template.
PUT https://marinaliu.visualstudio.com/DefaultCollection/Git2/_apis/build/definitions/templates/myCustomTemplate?api-version=2.0
Application/json:
{
"id": "android",
"name": "My Custom Andriod Template",
"category": "Build",
"iconTaskId": "DF857559-8715-46EB-A74E-AC98B9178AA0",
"description": "Build your Android projects, run tests, sign and align Android App Package files. This template requires the Android SDK to be installed on the build agent.",
"template": {
"buildNumberFormat": "$(date:yyyyMMdd)$(rev:.r)",
"build": [{
"enabled": true,
"inputs": {
"wrapperScript": "$(Parameters.wrapperScript)",
"tasks": "$(Parameters.tasks)"
},
"task": {
"id": "8D8EEBD8-2B94-4C97-85AF-839254CC6DA4",
"versionSpec": "1.*"
}
},
{
"enabled": true,
"inputs": {
"files": "**/*.apk",
"jarsign": "false",
"zipalign": "false"
},
"task": {
"id": "80F3F6A0-82A6-4A22-BA7A-E5B8C541B9B9",
"versionSpec": "1.*"
}
},
{
"enabled": true,
"alwaysRun": true,
"inputs": {
"SourceFolder": "$(build.sourcesdirectory)",
"Contents": "**/*.apk",
"TargetFolder": "$(build.artifactstagingdirectory)"
},
"task": {
"id": "5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c",
"versionSpec": "2.*"
}
},
{
"enabled": true,
"alwaysRun": true,
"inputs": {
"PathtoPublish": "$(build.artifactstagingdirectory)",
"ArtifactName": "drop",
"ArtifactType": "Container"
},
"task": {
"id": "2ff763a7-ce83-4e1f-bc89-0ae63477cebe",
"versionSpec": "1.*"
}
}
],
"options": [{
"definition": {
"id": "5D58CC01-7C75-450C-BE18-A388DDB129EC"
},
"enabled": true,
"inputs": {}
}],
"variables": {
"system.debug": {
"value": "false",
"allowOverride": true
}
},
"triggers": [],
"processParameters": {
"inputs": [{
"name": "wrapperScript",
"label": "{GradleWrapper}",
"defaultValue": "gradlew",
"required": true,
"type": "filePath"
},
{
"name": "tasks",
"label": "{GradleTasks}",
"defaultValue": "build",
"required": true,
"type": "string"
}
]
}
}
}
And the create an issue here, you can follow up.

Symfony2 composer adding own bundle requirement

How can I install a specific Bundle (for example SonataGoutteBundle) to my Symfony2 project via composer?
I tried this, but it doesn't work for me. Any ideas what's wrong?
"repositories": [
{
"type": "package",
"package": {
"name": "sonata-project/sonatagouttebundle",
"version": "dev-master",
"dist": {
"url": "https://github.com/sonata-project/SonataGoutteBundle.git",
"type": "git"
}
}
}
],
"require": {
"php": ">=5.3.3",
[...],
"sonata-project/sonatagouttebundle": "dev-master"
}
Try something like
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sonata-project/SonataGoutteBundle.git"
}
],
"require": {
"php": ">=5.3.3",
"vendor/bundle": "dev-master"
}
}
The SonataGoutteBundle must have a composer.json
In this particular case, this would work:
"repositories": [
{
"type": "package",
"package": {
"name": "sonata-project/goutte",
"version": "dev-master",
"source": {
"url": "https://github.com/sonata-project/SonataGoutteBundle.git",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"php": ">=5.3.3",
"sonata-project/goutte": "dev-master"
}
For all options see the documentation
You should provide a link to an archive (like zip) in "dist" section. If you want to use git you should define "source" section instead:
{
"repositories": [
{
"type": "package",
"package": {
"name": "sonata-project/sonatagouttebundle",
"version": "dev-master",
"source": {
"url": "https://github.com/sonata-project/SonataGoutteBundle.git",
"type": "git",
"reference": "master"
}
}
}
],
"require": {
"php": ">=5.3.3",
"sonata-project/sonatagouttebundle": "dev-master"
}
}
More about defining custom repositories: http://getcomposer.org/doc/04-schema.md#repositories

Resources