-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c98cb
commit 843e596
Showing
30 changed files
with
218 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{19C457D5-6780-4480-94CB-ED7E055402B8}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Bummer</RootNamespace> | ||
<AssemblyName>Bummer</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="FluentCommandLineParser, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\FluentCommandLineParser.1.4.3\lib\net35\FluentCommandLineParser.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\BummerLib\BummerLib.csproj"> | ||
<Project>{721fdfc9-6da9-4159-a54e-e448dfb9097d}</Project> | ||
<Name>BummerLib</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
//------------------------------------------------------------------------------ | ||
// <copyright company="CQSE GmbH"> | ||
// Copyright (c) CQSE GmbH | ||
// </copyright> | ||
// <license> | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </license> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Fclp; | ||
using Newtonsoft.Json; | ||
using System.Linq; | ||
|
||
namespace Cqse.ConQAT.Dotnet.Bummer | ||
{ | ||
/// <summary> | ||
/// Entry point class to the binary-source mapper. | ||
/// </summary> | ||
internal class Program | ||
{ | ||
|
||
/// <summary> | ||
/// The entry point of the program, where the program control | ||
/// starts and ends. | ||
/// </summary> | ||
/// <param name="args">The command-line arguments.</param> | ||
public static int Main(string[] args) | ||
{ | ||
var commandLineParser = new FluentCommandLineParser(); | ||
|
||
var filenames = new List<string>(); | ||
var assemblyNames = new List<string>(); | ||
|
||
commandLineParser.Setup<List<string>>('f', "files") | ||
.Callback(items => filenames = items) | ||
.WithDescription("Path(s) to symbol file(s) that should be analyzed.") | ||
.Required(); | ||
commandLineParser.Setup<List<string>>('a', "assemblyNames") | ||
.Callback(items => assemblyNames = items) | ||
.WithDescription("Assembly name(s) to be used in the AssemblyMethodMapping(s). Must have the same order and number of elements as the files parameter.") | ||
.Required(); | ||
|
||
commandLineParser.SetupHelp("?", "help") | ||
.Callback(text => Console.WriteLine(text)); | ||
|
||
var commandLineParseResult = commandLineParser.Parse(args); | ||
|
||
if (!filenames.Count.Equals(assemblyNames.Count)) | ||
{ | ||
Console.WriteLine("The parameters <files> and <assemblyNames> had different lengths. Aborting analysis."); | ||
return -1; | ||
} | ||
if (!commandLineParseResult.HasErrors) | ||
{ | ||
List<AssemblyMethodMappings> methodMappings = GetMethodMappings(filenames, assemblyNames); | ||
OutputMethodMappings(methodMappings); | ||
} | ||
else | ||
{ | ||
Console.WriteLine(commandLineParseResult.ErrorText); | ||
commandLineParser.HelpOption.ShowHelp(commandLineParser.Options); | ||
} | ||
return 0; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the method mappings for the specified list of file names. | ||
/// </summary> | ||
/// <param name="filenames">The list of symbol filenames to analyze.</param> | ||
private static List<AssemblyMethodMappings> GetMethodMappings(List<string> filenames, List<string> assemblyNames) | ||
{ | ||
var methodMappings = new List<AssemblyMethodMappings>(); | ||
var methodMapper = new MethodMapper(); | ||
// TODO (FS) please don't use 1-letter variable names | ||
Check warning on line 87 in BummerExe/Program.cs cqse.teamscale.io / teamscale-findingsBummerExe/Program.cs#L87
|
||
foreach (var pair in filenames.Zip(assemblyNames, (f, s) => new { filename = f, assemblyName = s })) | ||
{ | ||
if (!File.Exists(pair.filename)) | ||
{ | ||
Console.WriteLine("File does not exist: " + pair.filename); | ||
continue; | ||
} | ||
|
||
methodMappings.Add(methodMapper.GetMethodMappings(pair.filename, pair.assemblyName)); | ||
} | ||
return methodMappings; | ||
} | ||
|
||
/// <summary> | ||
/// Prints the specified list of method mappings on the console as JSON. | ||
/// </summary> | ||
/// <param name="methodMappings">The method mappings to save.</param> | ||
private static void OutputMethodMappings(List<AssemblyMethodMappings> methodMappings) | ||
{ | ||
var settings = new JsonSerializerSettings(); | ||
settings.Formatting = Formatting.None; | ||
var serializer = JsonSerializer.Create(settings); | ||
serializer.Serialize(Console.Out, methodMappings); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System.Reflection; | ||
|
||
[assembly: AssemblyTitle("Bummer")] | ||
[assembly: AssemblyProduct("Bummer")] | ||
[assembly: AssemblyCompany("CQSE GmbH")] | ||
[assembly: AssemblyCopyright("Copyright © CQSE GmbH")] | ||
[assembly: AssemblyDescription("Creates mappings between binary and source file methods based on .pdb or .mdb symbol files.")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FluentCommandLineParser" version="1.4.3" targetFramework="net48" /> | ||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" /> | ||
</packages> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters