Skip to content

Commit

Permalink
Renaming everything to SharpDebug (#40)
Browse files Browse the repository at this point in the history
Renaming all projects and moving them into new folders.
Increasing version to 2.0
Renaming namespace to SharpDebug.
Using SharpDebug_dumps.
Changing license to MIT.
  • Loading branch information
southpolenator authored Jun 24, 2019
1 parent 1651f54 commit f0122e6
Show file tree
Hide file tree
Showing 632 changed files with 1,269 additions and 1,527 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,16 @@ ModelManifest.xml
# Custom project files
*.VC.opendb
*.VC.db
/Utility/CsDebugScript.Reference/Help
/Utility/SharpDebug.Reference/Help
/NuGet.Packager/lib

# temp gvim files
*.swp
*.swo
/Source/CsDebugScript.VS/Microsoft.CodeAnalysis.dll
/Source/CsDebugScript.VS/Microsoft.CodeAnalysis.CSharp.dll
/Source/CsDebugScript.VS/System.Collections.Immutable.dll
/Source/CsDebugScript.VS/System.IO.FileSystem.dll
/Source/CsDebugScript.VS/System.Reflection.Metadata.dll
/Source/SharpDebug.VS/Microsoft.CodeAnalysis.dll
/Source/SharpDebug.VS/Microsoft.CodeAnalysis.CSharp.dll
/Source/SharpDebug.VS/System.Collections.Immutable.dll
/Source/SharpDebug.VS/System.IO.FileSystem.dll
/Source/SharpDebug.VS/System.Reflection.Metadata.dll
/Source/DiaHelpers/Dia2Lib.dll
/dumps
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "dumps/Source"]
path = dumps/Source
url = https://github.com/southpolenator/WinDbgCs_dumps/
url = https://github.com/southpolenator/SharpDebug_dumps/
2 changes: 1 addition & 1 deletion Documentation/Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Before running tests, you need to download all dumps. Execute `dumps\download.ps

With Visual Studio, you can use __Test Explorer__ to find and execute tests.

Enter `Tests\CsDebugScript.Tests.Native` directory. Run `dotnet test` command.
Enter `Tests\SharpDebug.Tests.Native` directory. Run `dotnet test` command.
12 changes: 6 additions & 6 deletions Documentation/CodeGen.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@ Here is an example XML configuration file:
</Modules>
<Transformations>
<Transformation OriginalType="std::any"
NewType="CsDebugScript.CommonUserTypes.NativeTypes.std.any" />
NewType="SharpDebug.CommonUserTypes.NativeTypes.std.any" />
<Transformation OriginalType="std::array&lt;${T},${Length}&gt;"
NewType="CsDebugScript.CommonUserTypes.NativeTypes.std.array&lt;${T}&gt;" />
NewType="SharpDebug.CommonUserTypes.NativeTypes.std.array&lt;${T}&gt;" />
<Transformation OriginalType="std::basic_string&lt;char,${char_traits},${allocator}&gt;"
NewType="CsDebugScript.CommonUserTypes.NativeTypes.std.@string" />
NewType="SharpDebug.CommonUserTypes.NativeTypes.std.@string" />
<Transformation OriginalType="std::vector&lt;${T},${allocator}&gt;"
NewType="CsDebugScript.CommonUserTypes.NativeTypes.std.vector&lt;${T}&gt;" />
NewType="SharpDebug.CommonUserTypes.NativeTypes.std.vector&lt;${T}&gt;" />
</Transformations>
<UseDirectClassAccess>true</UseDirectClassAccess>
<DontSaveGeneratedCodeFiles>true</DontSaveGeneratedCodeFiles>
<GeneratePhysicalMappingOfUserTypes>true</GeneratePhysicalMappingOfUserTypes>
</XmlConfig>
```
You can see more about all available XML fields in [source code](../Source/CsDebugScript.CodeGen/XmlConfig.cs).
You can see more about all available XML fields in [source code](../Source/SharpDebug.CodeGen/XmlConfig.cs).

#### Transformations
Transformations are being used for user types defined somewhere else (like [common user types](CommonUserTypes.md)). They allow mapping from symbol type to existing user type during code generation. For example, if user defines transformation for std::vector class like in example above, all members that are of type std::vector will be exported as CsDebubScript.commonUserTypes.NativeTypes.std.vector.

#### Generating physical mapping of user types
In order to fully benefit performance wise from code generation, you want to use this option. This will generate user types that read whole memory associated with the type (size of the type is written in symbol file) and later using types and offsets available from symbol file it will read directly from [MemoryBuffer](../Source/CsDebugScript.Engine/Engine/Utility/MemoryBuffer.cs). You can find all Read* functions in [UserType](../Source/CsDebugScript.Engine/UserType.cs) class.
In order to fully benefit performance wise from code generation, you want to use this option. This will generate user types that read whole memory associated with the type (size of the type is written in symbol file) and later using types and offsets available from symbol file it will read directly from [MemoryBuffer](../Source/SharpDebug.Engine/Engine/Utility/MemoryBuffer.cs). You can find all Read* functions in [UserType](../Source/SharpDebug.Engine/UserType.cs) class.

#### Using direct class access
Some symbol providers (DbgEng symbol provider) doesn't support getting base classes, class fields, but only all fields defined in the type. Modern symbol providers support direct class access and should be used by default.
Expand Down
52 changes: 26 additions & 26 deletions Documentation/CommonUserTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ You should read about [user types](UserTypes.md) before continuing

## Existing (common) user types
Currently implemented common user types:
* [STL](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std)
* [std::any](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/any.cs)
* [std::array](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/array.cs)
* [std::basic_string](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/basic_string.cs)
* [std::filesystem::path](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/filesystem/path.cs)
* [std::list](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/list.cs)
* [std::map](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/map.cs)
* [std::optional](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/optional.cs)
* [std::pair](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/pair.cs)
* [std::shared_ptr](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/shared_ptr.cs)
* [std::string](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/string.cs)
* [std::unordered_map](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/unordered_map.cs)
* [std::variant](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/variant.cs)
* [std::vector](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/vector.cs)
* [std::weak_ptr](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/weak_ptr.cs)
* [std::wstring](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/wstring.cs)
* [OpenCV](../Source/CsDebugScript.CommonUserTypes/NativeTypes/cv)
* [CvMat](../Source/CsDebugScript.CommonUserTypes/NativeTypes/cv/CvMat.cs)
* [cv::Mat](../Source/CsDebugScript.CommonUserTypes/NativeTypes/std/Mat.cs)
* [Windows](../Source/CsDebugScript.CommonUserTypes/NativeTypes/Windows)
* [Heap](../Source/CsDebugScript.CommonUserTypes/NativeTypes/Windows/Heap.cs)
* [ProcessEnvironmentBlock](../Source/CsDebugScript.CommonUserTypes/NativeTypes/Windows/ProcessEnvironmentBlock.cs)
* [ThreadEnvironmentBlock](../Source/CsDebugScript.CommonUserTypes/NativeTypes/Windows/ThreadEnvironmentBlock.cs)
* [CLR](../Source/CsDebugScript.CommonUserTypes/CLR)
* [System.Exception](../Source/CsDebugScript.CommonUserTypes/CLR/System/Exception.cs)
* [System.String](../Source/CsDebugScript.CommonUserTypes/CLR/System/String.cs)
* [STL](../Source/SharpDebug.CommonUserTypes/NativeTypes/std)
* [std::any](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/any.cs)
* [std::array](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/array.cs)
* [std::basic_string](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/basic_string.cs)
* [std::filesystem::path](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/filesystem/path.cs)
* [std::list](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/list.cs)
* [std::map](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/map.cs)
* [std::optional](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/optional.cs)
* [std::pair](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/pair.cs)
* [std::shared_ptr](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/shared_ptr.cs)
* [std::string](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/string.cs)
* [std::unordered_map](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/unordered_map.cs)
* [std::variant](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/variant.cs)
* [std::vector](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/vector.cs)
* [std::weak_ptr](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/weak_ptr.cs)
* [std::wstring](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/wstring.cs)
* [OpenCV](../Source/SharpDebug.CommonUserTypes/NativeTypes/cv)
* [CvMat](../Source/SharpDebug.CommonUserTypes/NativeTypes/cv/CvMat.cs)
* [cv::Mat](../Source/SharpDebug.CommonUserTypes/NativeTypes/std/Mat.cs)
* [Windows](../Source/SharpDebug.CommonUserTypes/NativeTypes/Windows)
* [Heap](../Source/SharpDebug.CommonUserTypes/NativeTypes/Windows/Heap.cs)
* [ProcessEnvironmentBlock](../Source/SharpDebug.CommonUserTypes/NativeTypes/Windows/ProcessEnvironmentBlock.cs)
* [ThreadEnvironmentBlock](../Source/SharpDebug.CommonUserTypes/NativeTypes/Windows/ThreadEnvironmentBlock.cs)
* [CLR](../Source/SharpDebug.CommonUserTypes/CLR)
* [System.Exception](../Source/SharpDebug.CommonUserTypes/CLR/System/Exception.cs)
* [System.String](../Source/SharpDebug.CommonUserTypes/CLR/System/String.cs)

STL classes are verified against different compilers and STL libraries (VS, GCC, Clang).

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Drawings.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Drawing objects
Drawing library help visualize results in [interactive mode](InteractiveMode.md). It can be used during debugging any image processing or computer vision app.

Basic interface used for creating objects is [IGraphics](../Source/CsDebugScript.Drawing.Interfaces/IGraphics.cs). It allows more than just visualizing images, you can visualize detected objects on images while debugging.
Basic interface used for creating objects is [IGraphics](../Source/SharpDebug.Drawing.Interfaces/IGraphics.cs). It allows more than just visualizing images, you can visualize detected objects on images while debugging.
In interactive mode, you can get this interface by quering global object `Graphics`.

Dumping drawing object will open drawing visualizer:
Expand Down
18 changes: 9 additions & 9 deletions Documentation/DumpProcessing.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
## Creating a new project that uses debugger engine
* Create a new .NET project (you can use Console Application)
* Add NuGet package CsDebugScript
* Add NuGet package SharpDebug
* Add initialization code:
```cs
using CsDebugScript;
using SharpDebug;

DebuggerInitialization.OpenDumpFile("path_to_dump_file", "symbol_path;srv*");
// After this line, you can execute any code that can be executed in the script
```

## Creating a new project that uses scripting and UI
* Create a new .NET project (you can use Console Application)
* Add NuGet package CsDebugScript
* Add NuGet package CsDebugScript.UI
* Add NuGet package SharpDebug
* Add NuGet package SharpDebug.UI
* Add initialization code:
```cs
CsDebugScript.DebuggerInitialization.OpenDumpFile("path_to_dump_file", "symbol_path;srv*");
CsDebugScript.UI.InteractiveWindow.ShowModalWindow();
SharpDebug.DebuggerInitialization.OpenDumpFile("path_to_dump_file", "symbol_path;srv*");
SharpDebug.UI.InteractiveWindow.ShowModalWindow();
```
Instead of opening interactive window, you can execute scripts:
```cs
CsDebugScript.ScriptExecution.Execute("path_to_script");
SharpDebug.ScriptExecution.Execute("path_to_script");
```
Or execute interactive commands with
```cs
var interactiveExecution = new CsDebugScript.InteractiveExecution();
var interactiveExecution = new SharpDebug.InteractiveExecution();
interactiveExecution.Interpret("<C# code>");
```

## Sample project
Please take a look at [CsDebugScript.Engine.Test](../Tests/CsDebugScript.Engine.Test/Program.cs). It shows how to:
Please take a look at [SharpDebug.Engine.Test](../Tests/SharpDebug.Engine.Test/Program.cs). It shows how to:
* Open a dump
* Execute some C# code against it
* Execute C# script
2 changes: 1 addition & 1 deletion Documentation/InteractiveMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Here are helper functions with dynamic arguments that can be used for easier vis
void DrawImage(dynamic width, dynamic height, dynamic data, ChannelType[] channels, dynamic stride = null);
```
Where `width`, `height` and `stride` can be any kind of number that can be casted to int. It can also be Variable that holds number type.
`channels` can be any value from `CsDebugScript.Drawing.Channels` predefined static fields or you can create a new one.
`channels` can be any value from `SharpDebug.Drawing.Channels` predefined static fields or you can create a new one.
`data` can be ulong value of the pointer, pointer to a simple type, or pointer to void. If pixel channel type cannot be deduced, you can use generics function:
```cs
void DrawImage<T>(dynamic width, dynamic height, dynamic data, ChannelType[] channels, dynamic stride = null);
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ HelpMe("It works!");
### Referencing assemblies in scripts
By now, you have huge collection of common code and compiling scripts is not that fast any more, you should create .NET library (dll) and just reference it from the script:
```cs
#r "CsDebugScript.CommonUserTypes.dll"
using std = CsDebugScript.CommonUserTypes.NativeTypes.std;
#r "SharpDebug.CommonUserTypes.dll"
using std = SharpDebug.CommonUserTypes.NativeTypes.std;

var variable = Process.Current.GetGlobal("mymodule!globalVariable");
var s = variable.CastAs<std.wstring>();
Expand Down
4 changes: 2 additions & 2 deletions Documentation/UserTypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This is ok approach, but there are some problems with it:
3. It won't be as fast as reading memory directly.

Here are some steps on how to improve it:
#### Start using [CodeArray](../Source/CsDebugScript.Engine/CodeArray.cs) (get some speed benefits)
#### Start using [CodeArray](../Source/SharpDebug.Engine/CodeArray.cs) (get some speed benefits)
```cs
CodeArray global_data = new CodeArray(Process.Current.GetGlobal("global_data"));
foreach (Variable data in global_data)
Expand Down Expand Up @@ -96,7 +96,7 @@ There are some special cases when you actually want to write user types manually
- Code generation doesn't know how to deal with C++ specializations for different number constants or has some other problems with your specific type
- You want to share your user types for different versions of library

In those cases, you want to help engine with work with these user types correctly. That means that you probably want to inherit [UserType](../Source/CsDebugScript.Engine/UserType.cs) class and also you want to add [UserTypeAttribute](../Source/CsDebugScript.Engine/UserTypeAttribute.cs) to new class.
In those cases, you want to help engine with work with these user types correctly. That means that you probably want to inherit [UserType](../Source/SharpDebug.Engine/UserType.cs) class and also you want to add [UserTypeAttribute](../Source/SharpDebug.Engine/UserTypeAttribute.cs) to new class.

Inheriting from UserType class will help with storing necessary data for you (like remembering Variable, or MemoryBuffer in advanced scenarios). Adding UserTypeAttribute to your class will trigger automatic casting in interactive mode. If you don't care about goddies of UserType and UserTypeAttribute, you should inherit Variable class when implementing your user type.

Expand Down
6 changes: 3 additions & 3 deletions Documentation/VisualStudioExtension.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Installing Visual Studio extension

### Visual Studio marketplace
Open __Extensions and Updates__ and in _Online_ gallery search for CsDebugScript.VS extension.
Open __Extensions and Updates__ and in _Online_ gallery search for SharpDebug.VS extension.

### Open [VSIX Gallery](http://vsixgallery.com)
VSIX gallery will provide access to newest versions of extensions.

Open __Options/Environment/Extensions and Updates__. Add additional gallery: http://vsixgallery.com/feed/

Open __Extensions and Updates__ and in new gallery search for CsDebugScript.VS extension.
Open __Extensions and Updates__ and in new gallery search for SharpDebug.VS extension.
![Open VSIX Gallery installation](Images/VS_Installation_VSIX_Gallery.png)

## Automatic visualizations
Expand All @@ -28,7 +28,7 @@ In order to define new visualizations, you need to do following:
2. Define NatVis file that will contain all the types that should be visualized

### Initialization script
By default, engine will load initialization script relative to the default project location: `CsDebugScript/init.csx'.
By default, engine will load initialization script relative to the default project location: `SharpDebug/init.csx'.

You can see more about how to define [user types](UserTypes.md).

Expand Down
16 changes: 8 additions & 8 deletions Documentation/WinDbgExtension.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
## Using WinDbg extension
1. Download extension from [latest GitHub release](https://github.com/southpolenator/WinDbgCs/releases/latest) or from [Latest build](https://ci.appveyor.com/project/southpolenator/windbgcs/branch/next).
1. Download extension from [latest GitHub release](https://github.com/southpolenator/SharpDebug/releases/latest) or from [Latest build](https://ci.appveyor.com/project/southpolenator/sharpdebug/branch/next).
2. Extract it to some folder (don't forget to "Unblock" zip file before extraction)
3. Load it into WinDbg session using [.load](https://msdn.microsoft.com/en-us/library/windows/hardware/ff563964%28v=vs.85%29.aspx) commnd. For example:
```
.load C:\debuggers\winext\CsDebugScript.WinDbg.x64.dll
.load C:\debuggers\winext\SharpDebug.WinDbg.x64.dll
```

## Executing C# scripts
Use `!execute` command exported from CsDebugScript.WinDbg extension:
Use `!execute` command exported from SharpDebug.WinDbg extension:
```
!execute path_to_csx_script [optional arguments given to the script]
```
Expand All @@ -17,14 +17,14 @@ For example:
```
In case you have one more extension that exports !execute command, you must specify extension at the beginning:
```
!CsDebugScript.execute c:\Scripts\myscript.csx
!SharpDebug.execute c:\Scripts\myscript.csx
```
Learn more about writting scripts in [Tutorials](Tutorials.md).

## Entering interactive mode
Use `!interactive` command exported from CsDebugScript extension:
Use `!interactive` command exported from SharpDebug extension:
```
!CsDebugScript.interactive
!SharpDebug.interactive
```
Interactive mode can execute both WinDbg commands and C# expressions. C# expression saves the state and must end with semicolon (;). WinDbg commands start with #dbg. For example you can enter following commands and not get an error:

Expand All @@ -39,9 +39,9 @@ Learn more about easier scripting in [interactive mode](InteractiveMode.md).
![Interactive mode](../samples/interactive.png)

## Entering UI interactive mode
Use `!openui` command exported from CsDebugScript extension:
Use `!openui` command exported from SharpDebug extension:
```
!CsDebugScript.openui
!SharpDebug.openui
```
UI interactive mode is more powerful than regular interactive mode as it provides C# editor, completion window, XML documentation, etc.

Expand Down
10 changes: 5 additions & 5 deletions GetShipFiles.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function Get-ShipFiles($dlls)
}

#Get-ShipFiles(@(
# #"CsDebugScript.CodeGen.App.exe",
# "CsDebugScript.CommonUserTypes.dll",
# "CsDebugScript.DwarfSymbolProvider.dll",
# "CsDebugScript.WinDbg.x64.dll",
# "CsDebugScript.WinDbg.x86.dll"));
# #"SharpDebug.CodeGen.App.exe",
# "SharpDebug.CommonUserTypes.dll",
# "SharpDebug.DwarfSymbolProvider.dll",
# "SharpDebug.WinDbg.x64.dll",
# "SharpDebug.WinDbg.x86.dll"));
6 changes: 3 additions & 3 deletions Properties/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;

[assembly: AssemblyCopyright("Copyright © CsDebugScript team 2015-2019")]
[assembly: AssemblyCopyright("Copyright © Vuk Jovanovic 2015-2019")]

// Version information for an assembly consists of the following four values:
//
Expand All @@ -12,5 +12,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4")]
[assembly: AssemblyFileVersion("1.4")]
[assembly: AssemblyVersion("2.0")]
[assembly: AssemblyFileVersion("2.0")]
Loading

0 comments on commit f0122e6

Please sign in to comment.