WinDbg do not release symbol files after unloading modules - windbg

From ages I was using windbg command:
!realod -u
to unload all symbols and release symbol files (.pdb) so I can freely rebuild projects. However recently (I mean at least few months ago) it stopped to work this way. Like usual windbg react to command:
kd> !reload -u
Unloaded all modules
but files are still locked by windbg executable. I can of course do usual trick with file rename so I can run rebuild, but it is getting really annoying (and time wasting). Did someone maybe managed to get around of this bug nicely and want to share?

I managed to solve it using Process Explorer by SysInternals
can be found here
Open it with administrative rights, and show the lower pane (Ctrl + L)
you'll see any open handle by the selected process. Select your windbg.exe and then - close the relevant file handle.

Related

Can you take terminal commands and use them in a Python program?

In another thread, there is an excellent step by step to completely uninstall VSCode off my Mac so I could truly start over. The steps work perfectly. In my question to try a lot of configurations and extensions, I mess up VSCode pretty often.
Is there a way to build Python file so when I need to uninstall, I can open a terminal window and run a program and be ready to try again? It is not the end of the world to have to type one line at a time, I'm just assuming this is common and been fixed. I'm just not able to find the how.
After doing some studying of Python, I found the OS module. Once you import it, most, if not all the commands to clean up directories, delete files, etc. are in there. I took the list of commands that ran in a ZSH terminal and converted them to os.[relevantcommand] and it worked fine. Now, I can easily clean out a VSCode install by running my VSCleanup.py and start over.

Where does breakpoints stores

In VSCode, where do the breakpoints store?
When I relaunch VSCode, those breakpoints still exists, so there should be a place for VSCode to store them. But it is stored neither in the workspace, nor in .vscode.
I need to know where they store so that I can backup/restore/add/modify/delete multiple breakpoints conveniently and efficiently.
Where are the breakpoints stored?
On Windows, the breakpoints are stored in:
%APPDATA%/Code/User/workspaceStorage/(long_hash)/state.vscdb
On Linux, they are in (per Matt's comment):
$HOME/.config/Code/User/workspaceStorage/(long_hash)/state.vscdb
To locate the (long_hash), I added a breakpoint and looked for a file that was recently modified. If you have Cygwin bash, a command like this works, right after adding or removing a breakpoint:
$ cd $APPDATA/Code
$ find . -mmin -1
The state.vscdb file is a SQLite database. I'm able to pull some data out of it using strings (another Cygwin command):
$ strings state.vscdb | grep 'debug.breakpoint'
debug.breakpoint
debug.breakpoint
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12},{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":13}]g
debug.breakpoint[{"enabled":true,"uri":{"$mid":1,"fsPath":"d:\\wrk\\learn\\vscode\\cpphello\\helloworld.cpp","_sep":1,"external":"file:///d%3A/wrk/learn/vscode/cpphello/helloworld.cpp","path":"/D:/wrk/learn/vscode/cpphello/helloworld.cpp","scheme":"file"},"lineNumber":12}]
The above is with a single breakpoint at helloworld.cpp line 12.
Is accessing this file a good idea?
Probably not!
If your goal is to query or manipulate the breakpoints yourself by modifying this file, I'd caution that that risks corrupting VSCode's internal storage (even if using a proper SQLite client).
I recommend instead using the VSCode extension APIs debug.breakpoints and debug.addBreakpoints to query and modify them from within VSCode.
On mac, it's
~/Library/Application Support/Code/User/workspaceStorage/<hash>

emacs can't open files outside current directory

So here is an interesting error...there is a particular folder on my desktop (hdrive, connected to a university-wide backup system, was set up automatically by IT) where emacs has difficulty opening files. In some directories within hdrive emacs can't open files above the current directory. For example,
cd ~/hdrive/directory/
emacs ../another_directory/file
gives the error message
emacs: `get_current_dir_name' failed: No such file or directory
I get the same error if instead I try
emacs ~/hdrive/another_directory/file
The files themselves are not missing and not corrupted, as using cat in place of emacs in these commands works fine. And I don't get this problem with all directories in hdrive - sometimes even a directory with this problem will have a subdirectory without it - but the directories with this problem are consistent.
There is no .dir-locals.el anywhere in hdrive, so that can't be messing things up.
Any ideas?
For me, this problem occurred because I was standing in a folder that I had deleted and recreated in another terminal (git issue).
Navigating away from the folder and back again made emacs and/or the terminal understand which folder I was actually in, and I could start emacs again with no problems.
I doubt this will solve the specific issue the questioner had, but anyone else ending up on this page through a google search on the error message might find my answer useful.

Storing code in Google Drive/DropBox

First I understand I should probably be using GitHub or some other online repository, but I would like to explore some of the concepts necessary for my method to work.
I would like to run a batch script/program every time I close Visual Studio, Eclipse, Notepad. Specifically, I would like to run a copy program to copy all of my source code that I generated with that program to a folder inside a Google Drive/Dropbox folder. That way I know it is saved to the cloud. this way I do not have to set up a special backup extension inside each Development enviornment.
Firstly is there a built in simple solution for doing the above? or Do I need to write a custom service that checks to see when those programs are closed? and if that is the way to go where should I look for an example of how to get started?
Thanks.
No, there is no simple built-in method that will backup the files that you want when you want it.
Instead you could simply point your work directories to your Gdrive or DropBox folders, and create a folder inside them for each.
Or you could create a task that copies the files every 10 minutes or however long.
But if you want it to run only when you exit the programs you specify: Yeah, you'll pretty much need to write a batch file for each of the programs you want to back up. Then call the batch file instead of the program.
startVS.bat
set DropBox=C:\Wherever\
start /wait "" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
xcopy /s /e /d /y "%userprofile%\Documents\Visual Studio 2008\Projects\*.*" "%DropBox%"
If you want to have the same icon, and for the batch file run minimized:
1) Open Windows Explorer, navigate to startVS.bat, right-click on it, and click Create Shortcut.
2) Right-click on startVS - ShortCut -> Click Rename and rename it Visual Studios, then press [ENTER].
3) Right-Click on the new Visual Studios -> Properties -> Change Icon -> Browse
4) Paste %ProgramFiles% (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
5) Click Open -> OK
6) Click Normal Window -> Minimized -> OK
7) Put a copy of Visual Studios (really named Visual Studios.lnk) where ever you want it, like in the Start menu.
If you are not running a 64 bit system, at step 4 paste %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
I think instead of going for this approach, you can run your script on a timely basis - say every 15 min.
This appraise will have below advantages advantages:
Easy to implement
Tool Independent
Timely Backup
Re-Use
So I think your problem will be solved by this approach.
For Google Drive, I've been messing around with GoogleCL: (I'm on Linux/Crunchbang)
$ sudo apt-get install python-gdata
$ sudo apt-get install googleCL
This'll give you the 'google' command:
$ which google
$ man google
You can upload files:
$ google docs upload foo.txt
(seems to store it as 'foo')
And download it: (in my opinion, syntax is inconsistent)
$ google docs get --title foo
(it won't find foo.txt for some reason)
So far, I'm not that happy with it. I want to encrypt files and park them there,
but it seems to choke on them. I've tried uuencoding them so I can just upload
a text file, but have had inconsistent results on files that aren't all that big
(1.6 Mbytes). Maybe Google doesn't want to deal with files it can't get any search
results out of ? Anyway, maybe Dropbox is better; haven't tried it yet.

Eclipse IDE; Open in current window / instance?

I've been using Eclipse for about a week now and I'm loving it.. great software for the 'price'. :P However, I'm having a few issues getting started.
The most annoying, so far, has been opening files from outside of Eclipse, and having them set to open w/ Eclipse. When I open a file from the file-explorer or an external application (WinSCP for instance), Eclipse seemingly attempts to open an entirely new instance itself rather than opening the file within a currently running instance. Of course, because this is the case, Eclipse errors out w/ 'The workspace is currently in use. Please select another' (or whatever it says).
Is there a configuration option, or an argument that I can use when opening a file externally that will simply use the currently open instance of Eclipse?
Thx in advance! :)
The easiest way to open external file in the current Eclipse is to drag-n-drop it to the tabbed area where your files are displayed. You should consider that Eclipse is seriously geared towards using files as part of a project and opening random file with Eclipse is certainly possible but not encouraged.
To your question - since Eclipse runs in Java if you attempt to use eclipse.exe to open a file then script will always try to open a new instance, I don't know if what you want is actually doable
To add to DroidIn.net's answer, here are a few eclipse bugs related to the question:
bug 4922 (from 2001!): "Need ability to open a file in eclipse from the command line", with sockent-monitoring kind of solutions, like the IBM proposition of opening an RCP from an URL, which leads to plugins like EclipseCalls.
EclipseCall is a plugin that accepts file-open requests on a defined socket port. A specialized client can be used to open a file in Eclipse by command from outside Eclipse, e.g. by double clicking a source file in Windows Explorer.
bug 178927 (2007): "way to pass arguments from launcher to a running application instance", based on a modifier launcher (more Windows-oriented, although bug 201154 is mac-oriented). An OSGi-based solution is also investigated.
(On Linux, see also steb)
In a Mac terminal, you can use open, though I needed to point to the executable explicitly, since I have more than one Eclipse installed:
open -a ~/eclipse/java-oxygen/Eclipse.app --args --launcher.openFile filename
You may or may not need --launcher.openFile, depending if you have --launcher.defaultAction set to openFile in your eclipse.ini file. (This config-file edit is also what you need for double-clicking or "open-with" to use the running Eclipse.)
For instance, I could do this (with gnu parallel) to open all of my failing tests after I'd copied to the clipboard (pbpaste is mac-specific):
pbpaste | parallel find . -name {}\\\* -print \
| parallel open -a ~/eclipse/java-oxygen/Eclipse.app
The Eclipse file-opening documentation for all OSes is here.