Laying out framework for ld65 debug symbol loader feature.

This commit is contained in:
harry 2023-02-12 08:30:14 -05:00
parent 18f09c8e76
commit c1e7465fe5
4 changed files with 105 additions and 1 deletions

View File

@ -287,6 +287,7 @@ set(SRC_CORE
${CMAKE_CURRENT_SOURCE_DIR}/filter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ines.cpp
${CMAKE_CURRENT_SOURCE_DIR}/input.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ld65dbg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/movie.cpp
${CMAKE_CURRENT_SOURCE_DIR}/netplay.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nsf.cpp

29
src/ld65dbg.cpp Normal file
View File

@ -0,0 +1,29 @@
// ld65dbg.cpp
#include <stdio.h>
#include "ld65dbg.h"
namespace ld65
{
//---------------------------------------------------------------------------------------------------
segment::segment( int id, const char *name, int startAddr, int size, int ofs, unsigned char type )
: _name(name ? name : ""), _id(id), _startAddr(startAddr), _size(size), _ofs(ofs), _type(type)
{
}
//---------------------------------------------------------------------------------------------------
scope::scope(int id, const char *name, int size, int parentID)
: _name(name ? name : ""), _id(id), _parentID(parentID), _size(size), _parent(nullptr)
{
}
//---------------------------------------------------------------------------------------------------
sym::sym(int id, const char *name, int size)
: _name(name ? name : ""), _id(id), _size(size)
{
}
//---------------------------------------------------------------------------------------------------
database::database(void)
{
}
//---------------------------------------------------------------------------------------------------
}

71
src/ld65dbg.h Normal file
View File

@ -0,0 +1,71 @@
// ld65dbg.h
//
#pragma once
#include <string>
#include <map>
namespace ld65
{
class database;
class segment
{
public:
static constexpr unsigned char READ = 0x01;
static constexpr unsigned char WRITE = 0x02;
segment( int id, const char *name = nullptr, int startAddr = 0, int size = 0, int ofs = -1, unsigned char type = READ );
private:
std::string _name; // Segment Name
int _id; // Debug ID
int _startAddr; // Start Address CPU
int _size; // Memory region size
int _ofs; // ROM Offset
unsigned char _type; // ro or rw
friend class database;
};
class scope
{
public:
scope( int id, const char *name = nullptr, int size = 0, int parentID = -1);
scope *getParent(void){ return _parent; };
private:
std::string _name; // Scope Name
int _id; // Debug ID
int _parentID; // Parent ID
int _size;
scope *_parent;
friend class database;
};
class sym
{
public:
sym( int id, const char *name = nullptr, int size = 0);
private:
std::string _name; // Scope Name
int _id; // Debug ID
int _size;
friend class database;
};
class database
{
public:
database(void);
private:
std::map<int, scope*> scopeMap;
std::map<int, segment*> segmentMap;
};
};

View File

@ -562,7 +562,6 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
<ClCompile Include="..\src\boards\t-262.cpp" />
<ClCompile Include="..\src\boards\tengen.cpp" />
<ClCompile Include="..\src\boards\tf-1201.cpp" />
<ClCompile Include="..\src\debugsymboltable.cpp" />
<ClCompile Include="..\src\drivers\common\args.cpp" />
<ClCompile Include="..\src\drivers\common\cheat.cpp" />
<ClCompile Include="..\src\drivers\common\config.cpp" />
@ -992,6 +991,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
<ClCompile Include="..\src\conddebug.cpp" />
<ClCompile Include="..\src\config.cpp" />
<ClCompile Include="..\src\debug.cpp" />
<ClCompile Include="..\src\debugsymboltable.cpp" />
<ClCompile Include="..\src\drawing.cpp" />
<ClCompile Include="..\src\fceu.cpp" />
<ClCompile Include="..\src\fds.cpp" />
@ -999,6 +999,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
<ClCompile Include="..\src\filter.cpp" />
<ClCompile Include="..\src\ines.cpp" />
<ClCompile Include="..\src\input.cpp" />
<ClCompile Include="..\src\ld65dbg.cpp" />
<ClCompile Include="..\src\lua-engine.cpp" />
<ClCompile Include="..\src\movie.cpp" />
<ClCompile Include="..\src\netplay.cpp" />
@ -1020,6 +1021,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
<ClInclude Include="..\src\cheat.h" />
<ClInclude Include="..\src\conddebug.h" />
<ClInclude Include="..\src\debug.h" />
<ClInclude Include="..\src\debugsymboltable.h" />
<ClInclude Include="..\src\drawing.h" />
<ClInclude Include="..\src\driver.h" />
<ClInclude Include="..\src\drivers\common\args.h" />
@ -1127,6 +1129,7 @@ xcopy /y /d "$(ProjectDir)\..\src\drivers\win\7z_64.dll" "$(OutDir)"</Command>
<ClInclude Include="..\src\input\fkb.h" />
<ClInclude Include="..\src\input\share.h" />
<ClInclude Include="..\src\input\suborkb.h" />
<ClInclude Include="..\src\ld65dbg.h" />
<ClInclude Include="..\src\movie.h" />
<ClInclude Include="..\src\netplay.h" />
<ClInclude Include="..\src\nsf.h" />