how deeply can the source path in windbg be nested? - directory

If I have multiple binaries whose sources are scattered in various subfolders of an overlaying folder, would windbg have access to them if only the topmost folder was included in Source Path? As opposed to having to reference each project folder of each relevant binary separately.
Assuming, of course, that the sources are unique in the mentioned folder structure, i.e. there are no multiple versions of one and the same project, source, etc.

If you specify the parent folder for the source files in source path then it should traverse through the subdirectories to find the source files.
Note that it will perform a signature match against your source files, in the same way that Visual studio will complain that the source files are different to the loaded dlls.
The relative locations of the source files must match the original locations so if your source files are located in a different structure then you will need to do a manual load/browse to specify the location of the source files.

Can’t answer exactly, but I often have 3 top (parent) directories, and each have approximately 4-5 levels of sub directories. No problems. However nothing beats using a source server

Short answer: NO.
From windbg's help:
For each directory in the symbol path, the debugger looks in three
directories. For example, if the symbol path includes the c:\MyDir
directory, and the debugger is looking for symbol information for a
DLL, the debugger first looks in c:\MyDir\symbols\dll, then in
c:\MyDir\dll, and finally in c:\MyDir. The debugger then repeats this
process for each directory in the symbol path. Finally, the debugger
looks in the current directory and then in the current directory with
\dll appended to it. (The debugger appends dll, exe, or sys, depending
on which binaries it is debugging.)
You can move all projects' .pdb files to one folder or change projects properties and setup the linker to create the .pdb file in a specific folder so you have to reference only one.

I've been doing a bit of debugging on this myself. From what I can tell, the relative path of the file found from the SourcePath needs to match part of the end path of the path embedded in the PDB. For example:
I have a file on disk at:
C:\Users\User\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\windows\thread_local_key.rs
The path of the file embedded in the PDB is:
/rustc/c09a9529c51cde41c1101e56049d418edb07bf71\/library\std\src\sys\windows\thread_local_key.rs
✔ This SourcePath, and any below it, correctly finds the file:
C:\Users\User\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust
❌ This SourcePath, and any above it, does not find the file:
C:\Users\User\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src
Notice how with the failure case, the relative path to the file would begin with library\. The library path component is the first part of the path that is not found in the embedded path. I assume it does a path check for every relative address, recursively:
thread_local_key.rs
windows\thread_local_key.rs
sys\windows\thread_local_key.rs
src\sys\windows\thread_local_key.rs
std\src\sys\windows\thread_local_key.rs
library\std\src\sys\windows\thread_local_key.rs
etc.

Related

Can i place native dependencies in a subfolder

When i publish a dotnet core project, it generated a single folder with hundreds of framework and native runtime files in it.
I understand that these files are required to make everything work, but can i move them into a subfolder and still get my app to run?
For example
MYAppFolder\
MyApp.exe
MyApp.exe.config
native\
hostfxr.dll
netstandard.dll
...
Is there some sort of probing path configuration that can do this?
As far as I can see you have a Standalone (SCD) app.
For that type of deployment hostfxr.dll should always exist in the app directory by convention.
As to other deps, you are able to move them to any locations, however you'll need to edit [AppName].deps.json for every build and also specify Additional probing paths. Besides, you are free to remove all the redundant dependencies (from deps.json and the file itself) if you are sure that you don't use them.
Check this demo where I've put all the dependencies of a Standalone app that could be moved to other location to a lib subdirectory.
please, note the following:
Additional probing path is set in HelloWorld.runtimeconfig.json but you can also use --additionalprobingpath [path] argument or Environment varibable
I've removed relative paths in deps.json file because otherwise I would have put the files to those relative paths sub directories - Additional probing path is considered to be a NuGet package cache thus have a package layout inside.
Also, consider having a Portable (FDD) type. You'll have a much less footprint and more flexibility arranging the files.

How to tell atom that a directory includes project source code?

Atom seems to assume that certain folders are non-project-source folders and thus should not be included in search results and fuzzy finder (cmd+t). I've noticed the following folders are treated this way and the text for these folders are also displayed darker in the file tree:
node_modules
lib
log
That's all fine and dandy, except that I have a lib folder that is in fact important project source code that I would like to access via fuzzy finder. Is there a way to instruct atom to include the lib folder in fuzzy finder results?
The Fuzzy Finder ignores files that are ignored by your VCS (Git in your case?) by default.
You can change that behavior by removing the check on the "Exclude VCS Ignored Paths" checkbox in the general settings:
In your case, is the lib folder part of your .gitignore file? If it is, then Atom wouldn't include it in its search results.

Publishing project with files with very long names

I am trying to publish a project in Visual Studio 2013 that has some files with very long names, including the path location. I moved the project to a location closer to my root C:\ drive, which allows it to compile, but when publishing, it tries to copy files to the %appdata% folder which results in a name over the limit.
Here is the error I get:
Error 10 Copying file node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml to C:\Users\jake\AppData\Local\Temp\WebSitePublish\WebProject--1320288221\obj\Debug\Package\PackageTmp\node_modules\grunt-bower\node_modules\bower\node_modules\bower-registry-client\node_modules\bower-config\node_modules\optimist\node_modules\minimist\.travis.yml failed. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. 0 0 WebProject
Is there a way to either adjust this project's name or where it copies to temporarily so that I am able to publish from Visual Studio?
Citing #Britton from Temp path too long when publishing a web site project:
Add this to your publish profile to modify the temporary directory for
package/publish:
<AspnetCompileMergeIntermediateOutputPath>c:\shortPath\</AspnetCompileMergeIntermediateOutputPath>
Or according to Website publish failing due to file path being too long (citing #Jason Beck and #VeeKayBee):
Add the following line in default PropertyGroup of web project file:
<IntermediateOutputPath>..\Temp</IntermediateOutputPath>
In addition to Amnon Shochot's answer, above, I also had to apply Roland's answer from another thread.
My publish paths (in .pubxml) now look like this:
<publishUrl>c:\publish\proj\</publishUrl>
<IntermediateOutputPath>c:\publish\inter\</IntermediateOutputPath>
<_PackageTempDir>c:\publish\package</_PackageTempDir>
You have to be careful with this:
Important: If this option is set, be sure not to nest your temporary files inside the publishUrl directory, because it will wipe out the _PackageTempDir files, causing a failed publish, even if it appears successful.

ClassLoader not recognizing programmatic jar file

I have a program that creates java source code files, compiles them to create class files and “jars up” the classfiles into a jar using java.utils.jar. When the resulting jar is placed in a lib directory in another application, the classes are supposed to be recognized. Except the created classfiles are not being recognized. So I used WinZip to zip the same class files, renamed the “zip” a “jar”, placed the new jar in the lib directory and the files are recognized fine. Used WinZip to look at the first (programmatically-produced) jar and the WinZip-created jar and they look identical. Same paths, same original size, same compressed size. Also tried creating a zip via java.utils.zip and renaming it. Same problem. Does anyone know of any reason why the programmatic zip/jar files could not be recognized by the Java class loader?
Solved. Maybe this will help others. The argument to ZipEntry (and JarEntry) must use forward slash ("/") as the name separator in order for the ClassLoader to correctly recognize the included files. In particular, other separators, such as those returned by File.getAbsolutePath(), while seemingly happily accepted by java.utils.jar and WinZip, will not be recognized by the ClassLoader.

Add application icon to air app while packaging with adt.jar: how to?

I built air app with icon in the past with flash builder, and everything was fine.
Now I have to build another app with adt(air developer tool), but I experience weird problems.
If I just place icon path relative to 'src' folder to app descriptor (as usual), it says:
error 303: Icon icon.png is missing from package.
If I use icon.png without path in app descriptor and then put this file everywhere(to root dir, to assets, to src, to build destination and so on), it again says error 303: Icon icon.png is missing from package.
If I try to add icon path to adt args like <arg value="icon.png"/> ( and put it to output folder as it seems that all path are relative to it in my case), it says The path icon.png is restricted. If you were trying to package Icon.png you should correct the case.
When I point to original file location ( <arg value="../src/assets/icon.png"/>), it outputs File ..\src\assets\icon.png is not relative to directory E:\projQ\flex\MyProject\bin (this bin directory is actually output directory). I've read unapproved comment on adobe forum that this is due to some sandbox limitations, but I'm not even sure that sandbox exists for adt( if it exists, then why? )
So, what shall I do to successfully add icon to that app?
I guess that using tools like resHacker to project's .exe will not help as .exe is just a launcher for .swf file, and anyway I consider that this awful way leads to the dark side of programming.
(P.S. can't add 'adt' tag that relates to adobe, not android.)
Nice. At last I've found the solution. So, the requirements for including icon while packaging manually with adt are:
Add file name to application descriptor without using any .. .
I beg you, don't even try to name your icon file icon.png. It is obvious name, and it was obvious for creators of adt. So it seems that they are renaming some files to icon.png or generating output to such file. Or put this file into some subdirectory of directory that is used as root by adt. Actually, error output exactly tells you to avoid using path icon.png. Correct the case phrase (which confused me) means rename your icon or move it deeper in directory hierarchy
Add path to your icon as command line argument to adt.
After generation you will see your icon inside generated output folder. You can remove it and application will still appear with your icon as expected.
This is more of an elaboration on the first point in the answer above to clarify for people like me who have been struggling with this issue.
The error reads "is not relative to directory", but what it means is "is not a child of directory". Basically even if you're trying to use a valid relative path, it expects it to point to something under your working directory. In my case the following trick worked:
./../..build/executable.swf
Replaced with
-C ./../.. build/executable.swf
-C makes ADT change directory to the one two levels above, and then you can specify the necessary file.
After playing with ADT a bit more, I now realise why it does that - the path you give to it will become the path within the package. So in the example above the file will be available inside the package at build/executable.swf. If you wish to make it available at package's root level, change the -C directive to the following:
-C ./../../build executable.swf

Resources