Getting the symbols with xperf - windows

I read through the docs and used the commands outlined however for some reason I dont seem to be getting any symbols, just a series of "unknowns" in the function column of the summary table for everything except the topmost set of the app I was trying to debug.... I set the enviromental variable to the microsoft server and the direcories containg the pdb's for the app. I also made sure to select the "Load Symbols" item before bringing up the summary table.
Arcording to the info I was reading it should take some time for the tabl to display while it loads the symbols, however for me the table displayed almost instantly and only the top most items in sprite.exe->sprite.exe had function names, the othe rows for function were either blank or "unknown"
Im using Vista SP1.
This is the batch file I used. Did I do anything that would prevent the sybols being loaded?
REM start profiler
xperf -on PROC_THREAD+LOADER+INTERRUPT+DPC+PROFILE^
-stackwalk profile -minbuffers 16 -maxbuffers 1024 -flushtimer 0^
-f tmp.etl
REM run the app we want to profile
sprite.exe
REM stop
xperf -d profile.etl
REM set symbol path
set _NT_SYMBOL_PATH = ^
C:\Projects\C++\fl lib\bin;^ REM dlls
C:\Projects\C++\fl lib\samples\bin;^ REM main exe
SRV*c:\symbols*http://msdl.microsoft.com/download/symbols
REM display profile
xperf profile.etl

What version of dbghelp.dll is it using? I've had trouble getting PDB symbols working with kernrate and other utilities when using the version of dbghelp.dll that is installed in %SystemRoot%\system32.
You may need to copy dbghelp.dll and symsrv.dll from a recent version of Debugging Tools for Windows into a directory where XPerf can find it.
Also, you need to remove the space before the '=', or else you're defining the "_NT_SYMBOL_PATH " variable (including the trailing space in the name).
Including comments at the end of a line is not going to work either. A line continuation character such as '^' typically needs to be the last character on the line. When I ran that statement (on XP), I ended up with "_NT_SYMBOL_PATH " equal to " C:\Projects\C++\fl lib\bin; REM dlls" and an error about the next line.

Try setting the
TRACE_FORMAT_SEARCH_PATH
environment variable. If that doesn't work, you may have to manually extract the TMF files from your PDBs using TracePdb.exe (or at least use a regular path instead of a SYM* path). This is by far the most annoying part of using ETL traces / XPerf

Related

Symbol Path Not Found in windbg

I have set the path as
srv*C:\Users\swpapati\Desktop\admintool_crash\pdbs*http://msdl.microsoft.com/download/symbols
where "C:\Users\swpapati\Desktop\admintool_crash\pdbs" exists and has the local copy of required symbol file values.
On loading the dmp crash file I can see below text on console :-
On issuing Command - .reload /f admintool.exe I can get below error as Symbol file not found.
Similar error is obtained on issuing !analyze -v or .reload /f
The admintool.pdb is present at C:\Users\swpapati\Desktop\admintool_crash\pdbs.
Also I have set the env variable
_NT_SYMBOL_PATH = srv*C:\Users\swpapati\Desktop\admintool_crash\pdbs*http://msdl.microsoft.com/download/symbols
What setting went wrong?
The admintool.pdb is present at C:\Users\swpapati\Desktop\admintool_crash\pdbs
You can't simply put a PDB file into a folder that has a structure of a symbol store.
There are at least 2 solutions:
a) put your own PDBs into the folder using the tool symstore.exe. This approach will require learning about how symbol stores are set up and how to use symstore.exe.
b) use two different paths, one for the Microsoft symbols and one folder with your own symbols. Commands are like this:
.sympath x:\whereever\your\pdbs\are\
.symfix+ x:\whereever\microsoft\symbols\should\go\
Note the + at the end of a command. It tells WinDbg to use that in addition to the existing symbol paths that are already set up.

Post-Build Event Works With one Project But Not the Other

I have 2 projects for which I am trying to create a generic Post-Build event batch file.
Here is the command in Visual Studio:
Post-Build event
if $(ConfigurationName) == Release ("$(ProjectDir)PostBuildRelease.bat" "$(TargetDir)" #(VersionNumber) "$(TargetFileName)" "$(TargetName)")
So I am calling the file PostBuildRelease.bat with 4 parameters:
Bin\Release Directory
Project Version
File Name With Extension
File Name Without Extension
Project 1
This works perfectly with this batch script:
CMD
SET parameter=%1 REM Full path to new bin\release\
SET parameter=%2 REM Full Version Number
SET parameter=%3 REM File name + extension
SET parameter=%4 REM File name - extension
SET "productionpath=Z:\Unused\Apps\LyncVdiChecker\"
MOVE %productionpath%%3 %productionpath%"_archive\"%4"."%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"-"%2
XCOPY %3 %productionpath%
Where the assembly is copied to Z:\Unused\Apps\LyncVdiChecker\ and the existing version copied to _archive in the same folder. The archived version also has the date and version number replace the file extension.
Project 2
This batch script also works perfectly (it does the same thing but in a different folder and for a different project):
CMD
SET parameter=%1 REM Full path to new bin\release\
SET parameter=%2 REM Full Version Number
SET parameter=%3 REM File name + extension
SET parameter=%4 REM File name - extension
SET "productionpath=Z:\Unused\Apps\IT Support App\"
MOVE "Z:\Unused\Apps\IT Support App\"%3 "Z:\Unused\Apps\IT Support App\_archive\"%4"."%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"-"%2
XCOPY %3 "Z:\Unused\Apps\IT Support App"
However, if I try using the same script from Project1 (the more generic version) in Project2, I get errors, even though the 2 scripts are equivalent:
Errors
The command "if Release == Release ("C:\Users\Seb.Kotze\Source\Repos\Applications\ITSelfHelp\ITHelp\PostBuildRelease.bat" "C:\Users\Seb.Kotze\Source\Repos\Applications\ITSelfHelp\ITHelp\bin\Release\" 2.0.6100.20905 "IT Self Help.exe" "IT Self Help")" exited with code 4.
Output Window:
The syntax of the command is incorrect.
Invalid number of parameters
This error is rather unhelpful, so I tried commenting out the 2 lines MOVE and XCOPY and build again:
Removed MOVE
Same error as above.
Output window:
Invalid number of parameters
Remove XCOPY
No Visual Studio Error, but this appears in the output window:
The syntax of the command is incorrect.
Parameter Output
When I echo out the parameters being used in Project2, everything seems to be in order:
"Path\to\Bin\Release"
2.0.6100.21082
"IT Self Help.exe"
"IT Self Help"
Z:\Unused\Apps\IT Support App\
How can I debug this issue? How is it possible that my script runs fine without any issues, but when run against a different project none of the commands are recognised? Any help with this is much appreciated!
You should normalize all your arguments, so they don't contain outer quotes.
Then you can use them in a reliable way.
The syntax set "variable=%~1" avoids outer quotes in the variable itself.
set "TargetDir=%~1"
set "VersionNumber=%~2"
set "TargetFileName=%~3"
set "TargetName=%~4"
SET "productionpath=Z:\IT Support App\"
set "dateStamp=%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"
MOVE "Z:\IT App\%TargetFileName%" "Z:\IT App\_archive\%TargetName%.%dateStamp%-%VersionNumber%"
XCOPY "%TargetFileName%" "Z:\IT App"
The problem is that the script is messing with the double quotes resulting in invalid paths and invalid number of arguments passed. When dealing with paths built dynamically, it's best to strip any existing " from the parts, and after the path is complete, surround it in ".
Dealing with batch arguments is explained on MSDN. Same thing for variables can be found on SS64.
I've played a bit with the file, and I was able to run it (from command line). The changes you should make in your (Project1) file:
SET productionpath="Z:\Unused\Apps\LyncVdiChecker\"
MOVE "%productionpath:"=%%~3" "%productionpath:"=%_archive\%~4.%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%-%~2"
XCOPY "%~3" "%productionpath:"=%"
I moved the " from the productionpath line to the beginning of its contents. That way will work with paths that contain SPACE s.
In the MOVE and XCOPY lines, I did what I explained above: even if the syntax is not that clear, it's more robust (the last "%productionpath:"=%" could be simple written as %productionpath%, but I left it in the the 1st form for consistency).
Note: You could remove the CMD command at the beginning of your batch, since it starts a new cmd instance(process) that doesn't end.
I found a solution to this, but I am still not sure what the cause was.
I suspect it has something to do with either one of:
Spaces in productionpath causing the command parameter declaration to escape
Quotes around one or more of the parameters creating a non-existent file path
After trying out a few changes to the script, I found that changing the productionpath declaration to SET productionpath="Z:\Unused\Apps\IT Support App\" solved the issue:
CMD
SET parameter=%1 REM Full path to new bin\release\
SET parameter=%2 REM Full Version Number
SET parameter=%3 REM File name + extension
SET parameter=%4 REM File name - extension
SET productionpath="Z:\Unused\Apps\IT Support App\"
MOVE "Z:\Unused\Apps\IT Support App\"%3 "Z:\Unused\Apps\IT Support App\_archive\"%4"."%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"-"%2
XCOPY %3 "Z:\Unused\Apps\IT Support App"
Making the same change to the Project1 script did not cause that to break either, so this seems safe.
Update
After reading some of the other answers, I amended the script once again to the following:
CMD
SET "TargetDir=%~1"
SET "VersionNumber=%~2"
SET "TargetFileName=%~3"
SET "TargetName=%~4"
SET "ProductionPath=Z:\Unused\Apps\IT Support App\"
SET "ArchivePath=%ProductionPath%_archive\"
SET "DateStamp=%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%"
MOVE "%ProductionPath%%TargetFileName%" "%ArchivePath%%TargetName%.%DateStamp%-%VersionNumber%"
XCOPY "%TargetFileName%" "%ProductionPath%"
Notice the "normalisation" of the paramaters - this removes all quotation marks from their values.
Also now using named parameters.

Windows program files path names?

Maybe this can be a silly question but I don't figure out how to search in google why in some code I read, it is used to write this way: \\progra~1
What does ~ and 1 mean?
I tried executing in Windows Run the same path but changing numbers and these are the results:
C:\progra~1 -> Opens Program Files
C:\progra~2 -> Opens Program Files(x86)
C:\progra~3 -> Opens ProgramData
C:\progra~4 -> Opens ProgramDevices, a folder I created in C:\
Why? Is this like a Match or something in the Folder names list?
For example a regex like "progra" and then to show the ~1 (First) match in some X order or ~2 (Second) ... etc?
It's a compatability mode with the old (really old) windows 8.3 naming convention. The ~n represents the instance of the name that has the same root characters.
In your example:
Program Files and Program Files(x86) have the same root characters Progra.
Hence one gets progra~1, the next progra~2 etc.
8.3 compatability can be turned off for a disk partition.
Exactly, it's a pattern counter.
Check out also this answer: What does %~d0 mean in a Windows batch file?
You can find more examples of different variables with modifiers here:
https://technet.microsoft.com/en-us/library/bb490909.aspx
(ctrl-f for "Variable substitution")

windows batch sqlite backup firefox history

Not familiar with windows stuffs.. , I'm trying to write a little MS Windows batch in order to backup firefox history but I'm not getting the expected result, eg the firefox history dump into a file (not implemented here), and can't figure out why and how to solve. Instead I get a dump of the database in a new window. Here is what I've done till now :
cmd windows terminal
start "TEST" sqlite.cmd
sqlite.cmd
REM backup firefox history
setlocal
set DB_src=places.sqlite
set DB_dest=places1.sqlite
set FF_profile=C:\Documents and Settings\User_A\Application Data\Mozilla\Firefox\Profiles\1e6xxxxx.default
set SQLITE_EXE=C:\Documents and Settings\Admin_User\SoftWare\sqlite3.exe
set SQLITE_SQL=C:\Documents and Settings\Admin_User\Bureau\sqlite.sql
copy "%FF_profile%\%DB_src%" "%FF_profile%\%DB_dest%"
#echo off
start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"
endlocal
sqlite.sql
.dump html
.output moz_places.html
SELECT moz_places.visit_count, moz_places.url FROM moz_places ORDER by visit_count DESC LIMIT 20;
[EDIT]:
Worked around :
- using the right sqlite query (updated in sqlite.sql below)as for these examples.
- using the sql html output "moz_places.html" as I could not get the redirection work.
linux stuffs are easier for me...
This question is lame, because it involves three completely unrelated domains: firefox, sqlite, and batch files. You should have isolated the problem by determining whether this is a firefox issue or an sqlite issue or a batch file issue and then you should have come up with a question regarding the domain in which the issue lies, with absolutely no mention to the other domains.
I am going to give you an answer as best as I can regarding batch files:
First of all, you need to stop needlessly using the start command and just invoke things directly. So, instead of:
start "%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"
You need this:
"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%"
Then, you need to redirect the output of the above command into a file of your choice. For this, you need to make use of the '>' operator. So:
"%SQLITE_EXE%" "%FF_profile%\%DB_dest%" < "%SQLITE_SQL%" > myfile.txt
That should do it, as far as batch files are concerned. If it does not do it, then it is a firefox or sqlite issue.

How to overcome limit of linking multiple object files in make file

I am new to makefile concept. So please can anyone give me example to overcome the problem of linking too many make files. Because I am getting error "fatal error U1095:" in my make file.
Assuming windows (since on windows, the command line is limited to 128 characters (?! really - sic?!))
I suggest you use #response files for LINK.EXE and or CL.exe etc.
LINK.EXE #response.tmp
You can store all commandline parameters in the text file without any limit.
Update MSDN calls them Command Files

Resources