Skip to content

Commit

Permalink
Add "v8 version" subcommand to llnode
Browse files Browse the repository at this point in the history
Fixes: nodejs#194
  • Loading branch information
vprab committed Sep 30, 2023
1 parent de1f01d commit d313c46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"src/node-constants.cc",
"src/settings.cc",
],
"cflags": [ '-DLLNODE_VERSION=<!(grep -Po \'"version": \K(".*")\' <(module_root_dir)/package.json)' ],
"conditions": [
[ "OS == 'win'", {
"sources": [
Expand Down
10 changes: 10 additions & 0 deletions src/llnode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ std::string GetActiveRequestsCmd::GetResultMessage(node::Environment* env,
return result_message.str();
}

bool GetLLNodeVersionCmd::DoExecute(SBDebugger d, char** cmd,
SBCommandReturnObject& result) {
result.Printf("llnode version %s", LLNODE_VERSION);
return true;
}


void InitDebugMode() {
bool is_debug_mode = false;
Expand Down Expand Up @@ -522,6 +528,10 @@ bool PluginInitialize(SBDebugger d) {
"Print all pending requests in the queue. Equivalent to "
"running process._getActiveRequests() on the living process.\n");

v8.AddCommand(
"version", new llnode::GetLLNodeVersionCmd(),
"print llnode version");

// Set initial value for color support
llnode::Settings* settings = llnode::Settings::GetSettings();
settings->SetColor("auto");
Expand Down
6 changes: 6 additions & 0 deletions src/llnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ class GetActiveRequestsCmd : public WorkqueueCmd {
std::string GetResultMessage(node::Environment* env, Error& err) override;
};

class GetLLNodeVersionCmd : public CommandBase {
public:
bool DoExecute(lldb::SBDebugger d, char** cmd,
lldb::SBCommandReturnObject& result) override;
};


} // namespace llnode

Expand Down

0 comments on commit d313c46

Please sign in to comment.