Can I debug gem5 in vs code? - gem5

I connected to my server via ssh on vs code. When I debug gem5, I use gdb to debug, but I have to display variables through commands like p var every time. Can I debug in vs code? Or is there any other way that I can display the value of the variable just by pointing at the variable with the mouse, just like debugging in visual studio?
I realize that gem5 is just a c++ executable program.
So I run it like a normal c++ program, but it doesn't stop at the breakpoint, it executes all.
This problem arises:
&"warning: gdb: failed to set controlling terminal: operation not permitted\n"
I tried the solutions in this video, but none of them worked.
https://www.youtube.com/watch?v=w_fpGfjAdXg&ab_channel=RoelVandePaar
I use the Code runner plugin to debug other C++ programs normally. What should I do please?

Adding the following changes to launch.json should help you set up gdb in vscode with Gem5. I found using GDB to be very useful to determine the call-chain and find errors.
"program": "${workspaceFolder}/build/X86/gem5.debug",
"args": ["--debug-break=<timestamp>", "${workspaceFolder}/<path to config file>"],

Related

CLion/PyCharm/PHPStorm/IntelliJ won't start, says "IDE has not been initialized yet"

When I try to start my CLion IDE (or another JetBrains IDE, like PyCharm, IntelliJ IDEA, PHP Storm etc), it fails, and I get the following message on the console:
IDE has not been initialized yet
(after the usual JVM warning I always get before and didn't prevent the IDE from starting up.)
Why is this happening? What can I do about it?
Notes:
I have a valid license.
May be related to this (resolved) issue for IntelliJ Idea.
Another instance of the IDE may be running
While you might not see it for some reason, there is another instance of your IDE already running (probably for your own user). The error message is somewhat misleading.
Let's assume you're running CLion for example. The executable's name is clion. Look for it with the ps command: ps aux | grep -i clion, or with pgrep: pgrep clion. Then terminate it (e.g. using kill with the process ID), and re-run.
Caveat: There may not be the only scenario in which you get the same error message.

Task Scheduler + Intermittantly failing + How do you debug or get a dump + windows7

I have 5 scheduled tasks that are scheduled to run every day at 9.30am. The schedule is basically a vbs script that opens an excel workbook and runs a macro. These 5 schedules can run fine if i run them seperately and 9 times out of 10 they run fine if I simulataneously run them from task scheduler. I do this by highlighting them all and then pressing run.
But sometimes when the task scheduler is doing its schedule they will fail. Sometimes all of them fail, sometimes some of them fail, but most of the time they all succeed.
Once I okay the errors(will post this next time it occurs) I can see the excel.exe in my Processes in TaskManager they are left hanging. I cannot see them in Applications because I run them in the background. Whilst here I know I can right click on the excel.exe and do a Create Dump file, but not sure what to do with this.
What I am interested here is discovering why they are failing? How do I debug it? Can I get a dump? how do i do this? I am sure the code is not perfect but the fact that they run fine seperately and most of the time fine together I am wondering is some memory resource getting used up at this time. This is what I would like to find out.
I know that i could space them out to run every minute, and this is something I might do but I would like to answer my questions above first.
Note: The vbs script in question can be found here in a previous question I asked.
EDIT1 Some useful links I have come accross following Noodles answer:
WinDBG: The very basics
question re: reading dump file
EDIT2
If i right click on check for a solution I can click on View Technical Details and that gives me:
`
Description
Faulting Application Path: C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE
Problem signature
Problem Event Name: APPCRASH
Application Name: EXCEL.EXE
Application Version: 14.0.7128.5000
Application Timestamp: 5398dfdc
Fault Module Name: EXCEL.EXE
Fault Module Version: 14.0.7128.5000
Fault Module Timestamp: 5398dfdc
Exception Code: c0000005
Exception Offset: 0023e751
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 5129
Additional Information 1: 8bde
Additional Information 2: 8bdedbea09a2027adb218b0e009eebf2
Additional Information 3: d4c1
Additional Information 4: d4c17b47443511f18e75ae920aa444bd
Extra information about the problem
Bucket ID: 361665432
`
EDIT3 : A useful walkthough example with commands
Crash Dumps
Load in Windbg. Then File menu - Open Crash Dump. Type !analyze (note wrong spelling)
Debugging
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.
Type lm to list loaded modules, x ! to list the symbols and bp symbolname to set a breakpoint
If programming in VB6 then this environmental variable link=/pdb:none stores the symbols in the dll rather than seperate files. Make sure you compile the program with No Optimisations and tick the box for Create Symbolic Debug Info. Both on the Compile tab in the Project's Properties.
Also CoClassSyms (microsoft.com/msj/0399/hood/hood0399.aspx) can make symbols from type libraries.
You can schedule this command line instead.
Autostarting Programs in Debugger
You can also make windbg attach to any specific program when started. See gflags.exe. Only in GUI mode.
Errors
Also get the error number. TS keeps a history of runs and their errors. TS has a history tab.
.

VB.NET Process.Start failing

A problem that has been plaguing me for nearly a week now.
I am trying to get an install of IIS to take place through the command line in VB. I understand that i need to be setting up an Unattended xml script to call, but here is a fundamental bit that is confusing me:
If i run the command : ' start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer; ' it executes perfectly within CMD.exe.
If i add the command to a batch file and run the batch file, it runs perfectly.
If i call the command using : Dim myProcess As Process = Process.Start("cmd.exe", "/k start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;"), then it fails with an error of:
////////////////////////////////////////////////////////////////////////////////////////////////////////////
Operation failed with 0x8007000B ////
////
An attempt was made to run the program in an incorrect format ////
////////////////////////////////////////////////////////////////////////////////////////////////////////
If i call the batch file mentioned earlier, then i get the exact same error.
How can it work perfectly with the two first examples but fail when it is called through VB?
Thanks for any help!
Your VB.NET program is very likely to be running in 32-bit mode and will start the 32-bit version of cmd.exe. The one from c:\windows\syswow64 instead of the one from c:\windows\system32 that you used before. Getting BadImageFormatException starts to become likely.
Project + Properties, Compile tab, set the Target CPU to AnyCPU and untick the "Prefer 32-bit" option. On older versions of VS click the Advanced Compile Options button to get to the setting.

Running grunt from MSBuild

This thread (Problem capturing error output) gives you a taste of the problem I'm struggling with. I'm trying to run grunt from MSBuild and the grunt errors are not displayed in the Visual Studio output window. I have a .NET project in Visual Studio Express 2012 for Web. I have imported an external project into the project build file with the IMPORT tag and in the imported project I have an Exec task attempting to run grunt. I obviously want to see the error messages that grunt outputs in my Visual Studio output window without too much fuss.
I found an extremely simple workaround that at least sends the output to a text file.
grunt.cmd > grunt-output.txt
This output file is in my .NET project folder somewhere so a quick refresh and double click allows me to open the output file and see a slightly garbled version of the grunt output in Visual Studio.
As an example I'm running a lint task on the grunt.js file, which contains things which JSHint would object to. I deliberately didn't put a semi-colon after var hello and so you get the error message Missing semicolon.
From the command line I get a nicely formatted error message.
Running "lint:files" (lint) task
Linting grunt.js...ERROR
[L2:C10] Missing semicolon.
var hello
<WARN> Task "lint:files" failed. Use --force to continue. </WARN>
Aborted due to warnings.
When I run it from Visual Studio, the output file contains this cluttered format:
[4mRunning "lint:files" (lint) task[24m
Linting grunt.js...[31mERROR[39m
[31m[[39m[33mL2[39m[31m:[39m[33mC10[39m[31m][39m [33mMissing semicolon.[39m
var hello[31m[7m [27m[39m
[31m<[39m[33mWARN[39m[31m>[39m [33mTask "lint:files" failed. Use --force to continue. [39m [31m</[39m[33mWARN[39m[31m>[39m
[31mAborted due to warnings.[39m
Does anyone recognise what all those square brackets and numbers are doing, and can anyone think of a command line switch or grunt switch or node.js switch that would interpret them and turn them into formatting? The don't look like some kind of encoding, they look more like tags to suggest to the command line environment how to format the message. Please don't suggest running some kind of regular expression replace function. I want something quick and easy otherwise it would become more trouble than it's worth.
UPDATE: this link Output gets cut off if piped into another application is pointing to a problem further upstream in node dating back 10 months. While that's getting sorted out it would be nice to at least get a more readable output file.
This thread on the grunt message board Pipe-redirecting Grunt's output is broken addresses this issue perfectly and provides a quick workaround while we wait for the overall issue to get fixed. They are escape codes to colour the output and the workaround is to use the --no-color option to remove colouring.
When I run this command from MSBuild
grunt.cmd --no-color > grunt-output.txt
I get nicely formatted output with exactly the same content as the command line:
Running "lint:files" (lint) task
Linting grunt.js...ERROR
[L2:C10] Missing semicolon.
var hello
<WARN> Task "lint:files" failed. Use --force to continue. </WARN>
Aborted due to warnings.
I can live without the colour. It would be nice if this could be sent to the output window, though, because MSBuild throws what seems like an error in the build process when in fact it's just JSHint tactfully hurting my feelings about my JavaScript.
In response to "I obviously want to see the error messages that grunt outputs in my Visual Studio output window without too much fuss."
I'd have a look at VsCommandBuddy ... it helps you integrate your grunt (and any other command for that matter) right inside visual studio. Commands are configured per solution/project, and at the time of this writing are being made available via menus, toolbar, shortcuts and the quicklaunch ...
http://visualstudiogallery.msdn.microsoft.com/f5da988e-2ec1-4061-a569-46d09733c668
It's a scratch-my-own-itch project. It helps me getting thins done. In every solution I open in visual studio, I simply get presented al the external commands I put togheter for that solution / or porject.
Output goes thorugh the outputwindow as desired. The no-color option for grunt removes all the noise.
Hope it helps!!

How to execute programs from geany using the GUI?

well i recently installed geany .. the ide is great and worked great for python programs ,
but when i try executing c/c++ programs from the executed button i get an error saying ./geany_run_script.sh: 5: ./rsa2: not found ( rsa is the name of my program )
well i did try googling out but could find a case like mine.
If you want to run a program, you need to compile it.
By default, the compile key in geany is F8.
Then, you can run the program. (F5)
You can define flags in project>properties (click on the "construct" tab).
I tried doing F8 and F5 and the problem was same as yours. But then i did build, compile and run and it worked.(This post may help someone !!)