Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish debug file (PDB) of binding.node #1337

Merged
merged 3 commits into from
Jan 21, 2016
Merged

Publish debug file (PDB) of binding.node #1337

merged 3 commits into from
Jan 21, 2016

Conversation

saper
Copy link
Member

@saper saper commented Jan 10, 2016

To ensure proper debugging of problems of Windows,
publish PDB debug file along with the binary.

In order to keep paths to the source files clean apply
the technique described by John Robbins in
"PDB Files: what every developer must know"
http://www.wintellect.com/devcenter/jrobbins/pdb-files-what-every-developer-must-know
and build node-sass in the "S:\node_modules\node-sass"

During debugging, source files can be referenced
via the virtual "S:" drive.

This allows users and developers to assign S: drive to the project
root ("node_modules") and access source files without having to redefine
source paths.

Artifact names are generated in a nice, Lisp-styled functional PowerShell
hidden in a YAML folded scalar!

Add node 5 to the PR testing build.

@saper
Copy link
Member Author

saper commented Jan 10, 2016

This is a little step to properly troubleshoot #1283 and other low-level Windows issues. Publishing PDB files is a recommended practice and we should do it as well.

A test build https://github.com/saper/node-sass/releases/tag/v3.4.2_debug should have all PDB files attached shortly. For testing please use binding.node files from the test repo.

Unfortunately, Visual Studio is unable to perform so-called "reproducible builds" so one has to use regenerated "binding.node" files for debugging, because they have to match exactly the "binding.pdb" files.

@am11 would love your feedback - I hope those files do load in Visual Studio :)

You can attach source files by using subst s: c:\your\directory, pointing one level below your node_modules directory.

Probably the PDB file needs to be renamed back to binding.pdb and put in the vendor directory next to the *.node.

@am11
Copy link
Contributor

am11 commented Jan 10, 2016

👍

The PDB files will definitely be useful to debug issue on Windows XP, as the remote debugging tools for XP are discontinued since VS2012. So getting the PDB file and using Dr. Watson: https://support.microsoft.com/en-us/kb/308538 will help us diagnosing binding issues on XP using WinDbg. I tried configuring Dr. Watson, but Event Viewer was not capturing dumps for crashes, so I had to fallback to rudimentary change-recompileOnWindows7-scpToWindowsXP-test-and-repeat approach. :)

Might be even possible to install VS2010 on XP SP3 and use these PDBs to debug, even though VS2010 cannot compile the C99/C++11 code, it can understand PDB format. To do that, the program needs to throw an assertion exception (which we can probably get by compiling binding in Debug configuration -- passing debug argument to node-gyp). Then open the solution in VS2010 on XP, run node-sass command form cmd and get the assertion error. The assertion error dialog has Debug button which further opens a menu to select a program to debug with. There we can either selected the opened VS2010 instance (in our case the one with binding.sln opened), a new instance or even WinDbg.

@saper
Copy link
Member Author

saper commented Jan 10, 2016

I'll have a look at XP later.

Can you try if those binding files and PDB files can be used to step through the code on modern Windows? Just check out sources into s:\node_modules\node-sass, put bindings and pdb into vendor and try to debug using local VS. Are you getting source files from S: drive displayed?

@saper
Copy link
Member Author

saper commented Jan 11, 2016

I have now published https://github.com/saper/node-sass/releases/tag/v3.4.2_vs2013 and https://github.com/saper/node-sass/releases/tag/v3.4.2_vs2015 - same node-sass code (with modified libsass for VS2013 compatibility) compiled respectively with VS2013 and VS2015.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 12, 2016

@saper I'll leave this in your and @am11's hand. Do whatever you need to do.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 20, 2016

What was the resolution here, is this going ahead?

@saper
Copy link
Member Author

saper commented Jan 20, 2016

This is ready to merge. I have generated PDB files and they work.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 20, 2016

Please rebase and ship this @saper

To ensure proper debugging of problems of Windows,
publish PDB debug file along with the binary.

In order to keep paths to the source files clean apply
the technique described by John Robbins in
"PDB Files: what every developer must know"
http://www.wintellect.com/devcenter/jrobbins/pdb-files-what-every-developer-must-know
and build node-sass in the "S:\node_modules\node-sass"

During debugging, source files can be referenced
via the virtual "S:" drive.

This allows users and developers to assign S: drive to the project
root ("node_modules") and access source files without having to redefine
source paths.

Artifact names are generated in a nice, Lisp-styled functional PowerShell
hidden in a YAML folded scalar!

Add node 5 to the PR testing build.
Use /RELEASE option of LINK.EXE
No need to wrap the section in a conditional
@saper saper merged commit f37d9a5 into sass:master Jan 21, 2016
@xzyfer xzyfer modified the milestone: next.patch Sep 4, 2016
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this pull request Apr 7, 2024
Fix the output of Maps with falsey keys and/or values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants