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

Implement debug symbol generation during the build process for Windows. #21733

Closed
Tracked by #9913 ...
Dwordcito opened this issue Feb 5, 2024 · 8 comments · Fixed by #22879
Closed
Tracked by #9913 ...

Implement debug symbol generation during the build process for Windows. #21733

Dwordcito opened this issue Feb 5, 2024 · 8 comments · Fixed by #22879
Assignees
Labels
level/task type/enhancement New feature or request

Comments

@Dwordcito
Copy link
Member

Dwordcito commented Feb 5, 2024

Description

Currently, Windows packages generated do not include debug symbols, which can hinder debugging efforts when issues arise. This issue aims to implement the necessary steps to generate packages with debug symbols for Windows installer packages.

Proposed Solution

  1. Update Packaging Scripts:
    • Modify the scripts responsible for generating Windows installer packages to incorporate the inclusion of debug symbols.
    • Implement any necessary logic to ensure that debug symbols are correctly packaged and included.

Research guidelines

NOTE: This is not a step-by-step process, but a research kickoff.

Prequisites: Windows >= 8.1

make TARGET=winagent DEBUG=yes . 
  • Copy Windows installer & source code. This might be important for Inspector, maybe not be necessary for the purpose of this issue.
  • Install Visual Studio 2019 Community
  • Install https://github.com/dlang/visuald. This is a VS plugin that includes cv2pdb, a software capable of generating .pdb files from a binary
  • Run the following command from PowerShell as administrator (fix paths if necessary):`
$ & "C:\Program Files (x86)\VisualD\cv2pdb\cv2pdb.exe" "C:\Program Files (x86)\ossec-agent\ossec-agent.exe" "C:\Program Files (x86)\ossec-agent\ossec-agent.exe"
  • Enhanced Debugging: Including debug symbols in the packages facilitates easier debugging and troubleshooting of issues encountered by users.
  • Improved Developer Experience: Developers benefit from having access to debug symbols when investigating issues reported by users.

Definition of Done

  • The Windows installer packaging process is updated to incorporate the inclusion of debug symbols.
@aritosteles
Copy link
Contributor

Update 03-22-2024
cv2pdb (CodeView to Program Database) research: this tool was conceived to extract CodeView debug information from executables and create a pdb file for modern debuggers to use. CodeView is a mostly deprecated format dating from the DOS and early windows times. Thus cv2pdb project has no updates since vs2010. It has no stand alone installer and it requires some (outdated) visual studio dlls to function. It should be able to use the libraries it needs without a full VS installation (remains to be checked). cv2pdb can manage DWARF debug info which is the go to format for modern linux compilers (also still unchecked).

@Leoquicenoz
Copy link
Contributor

ETA is delayed as work was being done on the issue wazuh-keystore directories are being created for agents #22616 with very high priority.

@aritosteles
Copy link
Contributor

Managed to extract debug information from a debug Windows executable compiled in Linux with -g flag, but only in a machine with Visual Studio installed. Failed to extract debug info in a clean VM.

@aritosteles
Copy link
Contributor

cv2pdb returns an error if Visual Studio is not installed. Seems to be looking for missing libraries. Installation instructions mention a version (10) of the libraries that were part of VS2010, which has been discontinued by Microsoft, both for support and even for download. Looking for a way to get a clean, matching set of these libraries or a way to use newer ones (current version is 14).

@Dwordcito
Copy link
Member Author

@aritosteles Which actual version of the community edition is needed? 2022 or 2019 it's ok?

@aritosteles
Copy link
Contributor

2019 works. We should try and see if the VC++ 2019 redistributable does the trick (instead of a full VS installation).

@aritosteles
Copy link
Contributor

As requested in issue 1004, by management decision, Visual Studio Community 2022 will be installed to prevent errors because of missing dependencies.

@aritosteles
Copy link
Contributor

Status: Finished writing standalone powershell script to extract debug information using cv2pdb.
Next: Merge it with the actual script that generates the Windows msi and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task type/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants