mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +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>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<RuntimeIdentifier>win</RuntimeIdentifier>
|
||||
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
|
||||
<PackageId>Cosmos.Build</PackageId>
|
||||
<PackageDescription>Cosmos build system.
|
||||
$(CosmosDescription)</PackageDescription>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
|
@ -18,7 +19,7 @@ namespace Cosmos.Build.Tasks
|
|||
[Required]
|
||||
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 StandardOutputLoggingImportance => MessageImportance.High;
|
||||
|
|
@ -52,25 +53,38 @@ namespace Cosmos.Build.Tasks
|
|||
{
|
||||
var xBuilder = new CommandLineBuilder();
|
||||
|
||||
xBuilder.AppendSwitch("--wide");
|
||||
xBuilder.AppendSwitch("--syms");
|
||||
string xPathToTool = Path.GetDirectoryName(GenerateFullPathToTool());
|
||||
|
||||
xBuilder.AppendFileNameIfNotNull(xPathToTool);
|
||||
|
||||
xBuilder.AppendFileNameIfNotNull(InputFile);
|
||||
|
||||
xBuilder.AppendSwitch(">");
|
||||
xBuilder.AppendFileNameIfNotNull(MapFile);
|
||||
|
||||
|
||||
return xBuilder.ToString();
|
||||
}
|
||||
|
||||
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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Build.Framework;
|
||||
|
|
@ -91,5 +92,19 @@ namespace Cosmos.Build.Tasks
|
|||
}
|
||||
|
||||
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.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -141,5 +142,20 @@ namespace Cosmos.Build.Tasks
|
|||
|
||||
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.Diagnostics;
|
||||
using System.IO;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
|
@ -84,6 +85,10 @@ namespace Cosmos.Build.Tasks
|
|||
{
|
||||
xBuilder.AppendSwitch("-dELF_COMPILATION");
|
||||
}
|
||||
else
|
||||
{
|
||||
xBuilder.AppendSwitch("-dBIN_COMPILATION");
|
||||
}
|
||||
|
||||
xBuilder.AppendSwitch("-O0");
|
||||
|
||||
|
|
@ -91,5 +96,20 @@ namespace Cosmos.Build.Tasks
|
|||
|
||||
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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Microsoft.Build.Framework;
|
||||
|
|
@ -19,6 +20,8 @@ namespace Cosmos.Build.Tasks
|
|||
|
||||
public override bool Execute()
|
||||
{
|
||||
var xSW = Stopwatch.StartNew();
|
||||
|
||||
try
|
||||
{
|
||||
var xSourceInfos = ParseMapFile(MapFile);
|
||||
|
|
@ -42,6 +45,11 @@ namespace Cosmos.Build.Tasks
|
|||
Log.LogErrorFromException(ex, true, true, null);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
xSW.Stop();
|
||||
Log.LogMessage(MessageImportance.High, "ReadNasmMapToDebugInfo task took {0}", xSW.Elapsed);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Label> ParseMapFile(string aMapFile)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<LdToolExe Condition = "'$(LdToolExe)' == ''">ld.exe</LdToolExe>
|
||||
|
||||
<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>
|
||||
<MkisofsToolExe Condition = "'$(MkisofsToolExe)' == ''">mkisofs.exe</MkisofsToolExe>
|
||||
|
|
@ -48,8 +48,6 @@
|
|||
<NasmOutput Condition="'$(NasmOutput)' == '' AND '$(BinFormat)' == 'ELF'">$(OutputPath)$(AssemblyName).obj</NasmOutput>
|
||||
<NasmOutput Condition="'$(NasmOutput)' == ''">$(OutputPath)$(AssemblyName).bin</NasmOutput>
|
||||
|
||||
<_NasmMap>$([System.IO.Path]::GetDirectoryName('$(NasmOutput)'))\main.map</_NasmMap>
|
||||
|
||||
<MapFile Condition="'$(MapFile)' == ''">$(OutputPath)$(AssemblyName).map</MapFile>
|
||||
<CosmosDebugSymbolsFile Condition="'$(CosmosDebugSymbolsFile)' == ''">$(OutputPath)$(AssemblyName).cdb</CosmosDebugSymbolsFile>
|
||||
|
||||
|
|
@ -219,7 +217,7 @@
|
|||
-->
|
||||
<Target Name="ExtractMapFromElfFile"
|
||||
Inputs="$(BinFile)"
|
||||
Outputs="$(CosmosDebugSymbolsPath)"
|
||||
Outputs="$(CosmosDebugSymbolsFile)"
|
||||
Condition="'$(BinFormat)' == 'ELF'">
|
||||
|
||||
<ExtractMapFromElfFile InputFile="$(BinFile)"
|
||||
|
|
@ -235,7 +233,7 @@
|
|||
ReadNasmMapToDebugInfo
|
||||
|
||||
[IN]
|
||||
$(_NasmMap) - a NASM map file.
|
||||
$(MapFile) - a NASM map file.
|
||||
|
||||
[OUT]
|
||||
$(CosmosDebugSymbolsPath) - a debug symbols file.
|
||||
|
|
@ -243,11 +241,11 @@
|
|||
================================================================================
|
||||
-->
|
||||
<Target Name="ReadNasmMapToDebugInfo"
|
||||
Inputs="$(_NasmMap)"
|
||||
Outputs="$(CosmosDebugSymbolsPath)"
|
||||
Inputs="$(MapFile)"
|
||||
Outputs="$(CosmosDebugSymbolsFile)"
|
||||
Condition="'$(BinFormat)' != 'ELF'">
|
||||
|
||||
<ReadNasmMapToDebugInfo MapFile="$(_NasmMap)"
|
||||
<ReadNasmMapToDebugInfo MapFile="$(MapFile)"
|
||||
DebugInfoFile="$(CosmosDebugSymbolsFile)" />
|
||||
|
||||
</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