mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 13:32:08 +00:00
Fix breakpoints for elf.
This commit is contained in:
parent
b9f92dab19
commit
3354519f91
8 changed files with 98 additions and 20 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net471</TargetFramework>
|
<TargetFramework>net471</TargetFramework>
|
||||||
<RuntimeIdentifier>win</RuntimeIdentifier>
|
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
|
||||||
<PackageId>Cosmos.Build</PackageId>
|
<PackageId>Cosmos.Build</PackageId>
|
||||||
<PackageDescription>Cosmos build system.
|
<PackageDescription>Cosmos build system.
|
||||||
$(CosmosDescription)</PackageDescription>
|
$(CosmosDescription)</PackageDescription>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Build.Framework;
|
using Microsoft.Build.Framework;
|
||||||
using Microsoft.Build.Utilities;
|
using Microsoft.Build.Utilities;
|
||||||
|
|
@ -18,7 +19,7 @@ namespace Cosmos.Build.Tasks
|
||||||
[Required]
|
[Required]
|
||||||
public string DebugInfoFile { get; set; }
|
public string DebugInfoFile { get; set; }
|
||||||
|
|
||||||
protected override string ToolName => "objdump.exe";
|
protected override string ToolName => "objdump.bat";
|
||||||
|
|
||||||
protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardErrorLoggingImportance => MessageImportance.High;
|
||||||
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
protected override MessageImportance StandardOutputLoggingImportance => MessageImportance.High;
|
||||||
|
|
@ -52,10 +53,12 @@ namespace Cosmos.Build.Tasks
|
||||||
{
|
{
|
||||||
var xBuilder = new CommandLineBuilder();
|
var xBuilder = new CommandLineBuilder();
|
||||||
|
|
||||||
xBuilder.AppendSwitch("--wide");
|
string xPathToTool = Path.GetDirectoryName(GenerateFullPathToTool());
|
||||||
xBuilder.AppendSwitch("--syms");
|
|
||||||
|
xBuilder.AppendFileNameIfNotNull(xPathToTool);
|
||||||
|
|
||||||
|
xBuilder.AppendFileNameIfNotNull(InputFile);
|
||||||
|
|
||||||
xBuilder.AppendSwitch(">");
|
|
||||||
xBuilder.AppendFileNameIfNotNull(MapFile);
|
xBuilder.AppendFileNameIfNotNull(MapFile);
|
||||||
|
|
||||||
return xBuilder.ToString();
|
return xBuilder.ToString();
|
||||||
|
|
@ -63,14 +66,25 @@ namespace Cosmos.Build.Tasks
|
||||||
|
|
||||||
public override bool Execute()
|
public override bool Execute()
|
||||||
{
|
{
|
||||||
if (!base.Execute())
|
Log.LogMessage(MessageImportance.High, "Extracting Map file...");
|
||||||
|
|
||||||
|
var xSW = Stopwatch.StartNew();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return false;
|
if (!base.Execute())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjDump.ExtractMapSymbolsForElfFile(DebugInfoFile, MapFile);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
xSW.Stop();
|
||||||
|
Log.LogMessage(MessageImportance.High, "Extracting Map file took {0}", xSW.Elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjDump.ExtractMapSymbolsForElfFile(DebugInfoFile, MapFile);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Build.Framework;
|
using Microsoft.Build.Framework;
|
||||||
|
|
@ -91,5 +92,19 @@ namespace Cosmos.Build.Tasks
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetResponseFileSwitch(string responseFilePath) => $"ResponseFile:{responseFilePath}";
|
protected override string GetResponseFileSwitch(string responseFilePath) => $"ResponseFile:{responseFilePath}";
|
||||||
|
|
||||||
|
public override bool Execute()
|
||||||
|
{
|
||||||
|
var xSW = Stopwatch.StartNew();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return base.Execute();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
xSW.Stop();
|
||||||
|
Log.LogMessage(MessageImportance.High, "IL2CPU task took {0}", xSW.Elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -141,5 +142,20 @@ namespace Cosmos.Build.Tasks
|
||||||
|
|
||||||
return xBuilder.ToString();
|
return xBuilder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Execute()
|
||||||
|
{
|
||||||
|
var xSW = Stopwatch.StartNew();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return base.Execute();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
xSW.Stop();
|
||||||
|
Log.LogMessage(MessageImportance.High, "LD task took {0}", xSW.Elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Build.Framework;
|
using Microsoft.Build.Framework;
|
||||||
using Microsoft.Build.Utilities;
|
using Microsoft.Build.Utilities;
|
||||||
|
|
@ -84,6 +85,10 @@ namespace Cosmos.Build.Tasks
|
||||||
{
|
{
|
||||||
xBuilder.AppendSwitch("-dELF_COMPILATION");
|
xBuilder.AppendSwitch("-dELF_COMPILATION");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xBuilder.AppendSwitch("-dBIN_COMPILATION");
|
||||||
|
}
|
||||||
|
|
||||||
xBuilder.AppendSwitch("-O0");
|
xBuilder.AppendSwitch("-O0");
|
||||||
|
|
||||||
|
|
@ -91,5 +96,20 @@ namespace Cosmos.Build.Tasks
|
||||||
|
|
||||||
return xBuilder.ToString();
|
return xBuilder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Execute()
|
||||||
|
{
|
||||||
|
var xSW = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return base.Execute();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
xSW.Stop();
|
||||||
|
Log.LogMessage(MessageImportance.High, "Nasm task took {0}", xSW.Elapsed);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Build.Framework;
|
using Microsoft.Build.Framework;
|
||||||
|
|
@ -19,6 +20,8 @@ namespace Cosmos.Build.Tasks
|
||||||
|
|
||||||
public override bool Execute()
|
public override bool Execute()
|
||||||
{
|
{
|
||||||
|
var xSW = Stopwatch.StartNew();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var xSourceInfos = ParseMapFile(MapFile);
|
var xSourceInfos = ParseMapFile(MapFile);
|
||||||
|
|
@ -42,6 +45,11 @@ namespace Cosmos.Build.Tasks
|
||||||
Log.LogErrorFromException(ex, true, true, null);
|
Log.LogErrorFromException(ex, true, true, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
xSW.Stop();
|
||||||
|
Log.LogMessage(MessageImportance.High, "ReadNasmMapToDebugInfo task took {0}", xSW.Elapsed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Label> ParseMapFile(string aMapFile)
|
private static List<Label> ParseMapFile(string aMapFile)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<LdToolExe Condition = "'$(LdToolExe)' == ''">ld.exe</LdToolExe>
|
<LdToolExe Condition = "'$(LdToolExe)' == ''">ld.exe</LdToolExe>
|
||||||
|
|
||||||
<ObjdumpToolPath Condition = "'$(ObjdumpToolPath)' == ''">$(CosmosToolsPath)cygwin\win\</ObjdumpToolPath>
|
<ObjdumpToolPath Condition = "'$(ObjdumpToolPath)' == ''">$(CosmosToolsPath)cygwin\win\</ObjdumpToolPath>
|
||||||
<ObjdumpToolExe Condition = "'$(ObjdumpToolExe)' == ''">objdump.exe</ObjdumpToolExe>
|
<ObjdumpToolExe Condition = "'$(ObjdumpToolExe)' == ''">objdump.bat</ObjdumpToolExe>
|
||||||
|
|
||||||
<MkisofsToolPath Condition = "'$(MkisofsToolPath)' == ''">$(CosmosToolsPath)mkisofs\win\</MkisofsToolPath>
|
<MkisofsToolPath Condition = "'$(MkisofsToolPath)' == ''">$(CosmosToolsPath)mkisofs\win\</MkisofsToolPath>
|
||||||
<MkisofsToolExe Condition = "'$(MkisofsToolExe)' == ''">mkisofs.exe</MkisofsToolExe>
|
<MkisofsToolExe Condition = "'$(MkisofsToolExe)' == ''">mkisofs.exe</MkisofsToolExe>
|
||||||
|
|
@ -48,8 +48,6 @@
|
||||||
<NasmOutput Condition="'$(NasmOutput)' == '' AND '$(BinFormat)' == 'ELF'">$(OutputPath)$(AssemblyName).obj</NasmOutput>
|
<NasmOutput Condition="'$(NasmOutput)' == '' AND '$(BinFormat)' == 'ELF'">$(OutputPath)$(AssemblyName).obj</NasmOutput>
|
||||||
<NasmOutput Condition="'$(NasmOutput)' == ''">$(OutputPath)$(AssemblyName).bin</NasmOutput>
|
<NasmOutput Condition="'$(NasmOutput)' == ''">$(OutputPath)$(AssemblyName).bin</NasmOutput>
|
||||||
|
|
||||||
<_NasmMap>$([System.IO.Path]::GetDirectoryName('$(NasmOutput)'))\main.map</_NasmMap>
|
|
||||||
|
|
||||||
<MapFile Condition="'$(MapFile)' == ''">$(OutputPath)$(AssemblyName).map</MapFile>
|
<MapFile Condition="'$(MapFile)' == ''">$(OutputPath)$(AssemblyName).map</MapFile>
|
||||||
<CosmosDebugSymbolsFile Condition="'$(CosmosDebugSymbolsFile)' == ''">$(OutputPath)$(AssemblyName).cdb</CosmosDebugSymbolsFile>
|
<CosmosDebugSymbolsFile Condition="'$(CosmosDebugSymbolsFile)' == ''">$(OutputPath)$(AssemblyName).cdb</CosmosDebugSymbolsFile>
|
||||||
|
|
||||||
|
|
@ -219,7 +217,7 @@
|
||||||
-->
|
-->
|
||||||
<Target Name="ExtractMapFromElfFile"
|
<Target Name="ExtractMapFromElfFile"
|
||||||
Inputs="$(BinFile)"
|
Inputs="$(BinFile)"
|
||||||
Outputs="$(CosmosDebugSymbolsPath)"
|
Outputs="$(CosmosDebugSymbolsFile)"
|
||||||
Condition="'$(BinFormat)' == 'ELF'">
|
Condition="'$(BinFormat)' == 'ELF'">
|
||||||
|
|
||||||
<ExtractMapFromElfFile InputFile="$(BinFile)"
|
<ExtractMapFromElfFile InputFile="$(BinFile)"
|
||||||
|
|
@ -235,7 +233,7 @@
|
||||||
ReadNasmMapToDebugInfo
|
ReadNasmMapToDebugInfo
|
||||||
|
|
||||||
[IN]
|
[IN]
|
||||||
$(_NasmMap) - a NASM map file.
|
$(MapFile) - a NASM map file.
|
||||||
|
|
||||||
[OUT]
|
[OUT]
|
||||||
$(CosmosDebugSymbolsPath) - a debug symbols file.
|
$(CosmosDebugSymbolsPath) - a debug symbols file.
|
||||||
|
|
@ -243,11 +241,11 @@
|
||||||
================================================================================
|
================================================================================
|
||||||
-->
|
-->
|
||||||
<Target Name="ReadNasmMapToDebugInfo"
|
<Target Name="ReadNasmMapToDebugInfo"
|
||||||
Inputs="$(_NasmMap)"
|
Inputs="$(MapFile)"
|
||||||
Outputs="$(CosmosDebugSymbolsPath)"
|
Outputs="$(CosmosDebugSymbolsFile)"
|
||||||
Condition="'$(BinFormat)' != 'ELF'">
|
Condition="'$(BinFormat)' != 'ELF'">
|
||||||
|
|
||||||
<ReadNasmMapToDebugInfo MapFile="$(_NasmMap)"
|
<ReadNasmMapToDebugInfo MapFile="$(MapFile)"
|
||||||
DebugInfoFile="$(CosmosDebugSymbolsFile)" />
|
DebugInfoFile="$(CosmosDebugSymbolsFile)" />
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
|
||||||
7
source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.bat
Normal file
7
source/Cosmos.Build.Tasks/tools/cygwin/win/objdump.bat
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM %1 == ToolPath
|
||||||
|
REM %2 == ElfFile
|
||||||
|
REM %3 == MapFile
|
||||||
|
|
||||||
|
"%1\objdump.exe" --wide --syms %2 > %3
|
||||||
Loading…
Reference in a new issue