HyperDbg Debugger
Loading...
Searching...
No Matches
sympath.cpp File Reference

.sympath command More...

#include "pch.h"

Functions

VOID CommandSympathHelp ()
 help of the .sympath command
 
VOID CommandSympath (vector< string > SplitCommand, string Command)
 .sympath command handler
 

Detailed Description

.sympath command

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2021-05-27

Function Documentation

◆ CommandSympath()

VOID CommandSympath ( vector< string > SplitCommand,
string Command )

.sympath command handler

Parameters
SplitCommand
Command
Returns
VOID
45{
46 string SymbolServer = "";
47 string Token;
48
49 if (SplitCommand.size() == 1)
50 {
51 //
52 // Show the current symbol path
53 //
54 if (!CommandSettingsGetValueFromConfigFile("SymbolServer", SymbolServer))
55 {
56 ShowMessages("symbol server is not configured, please use '.help .sympath'\n");
57 }
58 else
59 {
60 ShowMessages("current symbol server is : %s\n", SymbolServer.c_str());
61 }
62 }
63 else
64 {
65 //
66 // Save the symbol path
67 //
68
69 //
70 // Trim the command
71 //
72 Trim(Command);
73
74 //
75 // Remove .sympath from it
76 //
77 Command.erase(0, SplitCommand.at(0).size());
78
79 //
80 // Trim it again
81 //
82 Trim(Command);
83
84 //
85 // *** validate the symbols ***
86 //
87
88 //
89 // Check if the string contains '*'
90 //
91 char Delimiter = '*';
92 if (Command.find(Delimiter) != std::string::npos)
93 {
94 //
95 // Found
96 //
97 Token = Command.substr(0, Command.find(Delimiter));
98 // using transform() function and ::tolower in STL
99 transform(Token.begin(), Token.end(), Token.begin(), ::tolower);
100
101 //
102 // Check if it starts with srv
103 //
104 if (!Token.compare("srv"))
105 {
106 //
107 // Save the config
108 //
109 CommandSettingsSetValueFromConfigFile("SymbolServer", Command);
110
111 //
112 // Show the message
113 //
114 ShowMessages("symbol server/path is configured successfully\n");
115 ShowMessages("use '.sym load', '.sym reload', or '.sym download' to load pdb files\n");
116 }
117 else
118 {
119 ShowMessages("symbol path is invalid\n\n");
121 return;
122 }
123 }
124 else
125 {
126 ShowMessages("symbol path is invalid\n\n");
128 return;
129 }
130 }
131}
void Trim(std::string &s)
trim from both ends and start of a string (in place)
Definition common.cpp:594
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
VOID CommandSettingsSetValueFromConfigFile(std::string OptionName, std::string OptionValue)
Sets the setting values from config file.
Definition settings.cpp:115
BOOLEAN CommandSettingsGetValueFromConfigFile(std::string OptionName, std::string &OptionValue)
Gets the setting values from config file.
Definition settings.cpp:60
VOID CommandSympathHelp()
help of the .sympath command
Definition sympath.cpp:24

◆ CommandSympathHelp()

VOID CommandSympathHelp ( )

help of the .sympath command

Returns
VOID
25{
26 ShowMessages(".sympath : shows and sets the symbol server and path.\n\n");
27
28 ShowMessages("syntax : \t.sympath\n");
29 ShowMessages("syntax : \t.sympath [SymServer (string)]\n");
30
31 ShowMessages("\n");
32 ShowMessages("\t\te.g : .sympath\n");
33 ShowMessages("\t\te.g : .sympath SRV*c:\\Symbols*https://msdl.microsoft.com/download/symbols \n");
34}