tracy/server/TracySourceView.hpp

81 lines
1.6 KiB
C++
Raw Normal View History

2020-04-01 23:02:42 +00:00
#ifndef __TRACYSOURCEVIEW_HPP__
#define __TRACYSOURCEVIEW_HPP__
2020-03-25 21:37:34 +00:00
#include <string>
#include <vector>
2020-04-04 00:25:12 +00:00
#include "tracy_robin_hood.h"
2020-03-28 00:22:27 +00:00
#include "TracyDecayValue.hpp"
struct ImFont;
namespace tracy
{
class Worker;
class SourceView
{
struct Line
{
const char* begin;
const char* end;
};
2020-03-25 21:37:34 +00:00
struct AsmLine
{
uint64_t addr;
2020-03-27 23:53:48 +00:00
uint64_t jumpAddr;
2020-03-25 21:37:34 +00:00
std::string mnemonic;
std::string operands;
};
2020-04-04 00:25:12 +00:00
struct JumpData
{
uint64_t min;
uint64_t max;
int level;
std::vector<uint64_t> source;
};
public:
SourceView( ImFont* font );
~SourceView();
void Open( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr, const Worker& worker );
void Render( const Worker& worker );
private:
void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal, const Worker& worker );
2020-03-28 13:27:29 +00:00
void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut );
2020-03-25 21:53:05 +00:00
bool Disassemble( uint64_t symAddr, const Worker& worker );
ImFont* m_font;
const char* m_file;
uint32_t m_fileStringIdx;
2020-03-24 23:07:31 +00:00
uint64_t m_symAddr;
2020-03-28 00:22:27 +00:00
uint64_t m_currentAddr;
uint64_t m_baseAddr;
2020-03-25 21:53:05 +00:00
uint64_t m_targetAddr;
char* m_data;
size_t m_dataSize;
int m_targetLine;
int m_selectedLine;
2020-03-25 21:53:05 +00:00
bool m_showAsm;
uint32_t m_codeLen;
2020-03-28 00:22:27 +00:00
DecayValue<uint64_t> m_highlightAddr;
bool m_asmRelative;
2020-04-01 23:37:56 +00:00
bool m_asmShowSourceLocation;
std::vector<Line> m_lines;
2020-03-25 21:37:34 +00:00
std::vector<AsmLine> m_asm;
2020-04-04 00:25:12 +00:00
unordered_flat_map<uint64_t, JumpData> m_jumpTable;
int m_maxJumpLevel;
};
}
2020-04-01 23:02:42 +00:00
#endif