Trace winpty version info, move agent trace output as early as possible

This commit is contained in:
Ryan Prichard 2016-04-10 16:22:32 -05:00
parent c677b8dd0a
commit 3e75255e6b
7 changed files with 21 additions and 3 deletions

View File

@ -126,8 +126,7 @@ Agent::Agent(LPCWSTR controlPipeName,
m_directMode(false),
m_ptySize(initialCols, initialRows)
{
trace("Agent starting...");
dumpWindowsVersion();
trace("Agent::Agent entered");
m_bufferData.resize(BUFFER_LINE_COUNT);

View File

@ -26,6 +26,7 @@
#include "Agent.h"
#include "DebugShowInput.h"
#include "../shared/StringUtil.h"
#include "../shared/WindowsVersion.h"
#include "../shared/WinptyAssert.h"
#include "../shared/WinptyVersion.h"
@ -46,6 +47,9 @@ const char USAGE[] =
int main()
{
dumpWindowsVersion();
dumpVersionToTrace();
// Technically, we should free the CommandLineToArgvW return value using
// a single call to LocalFree, but the call will never actually happen in
// the normal case.

View File

@ -32,7 +32,8 @@ LIBWINPTY_OBJECTS = \
build/libwinpty/shared/WindowsSecurity.o \
build/libwinpty/shared/WindowsVersion.o \
build/libwinpty/shared/WinptyAssert.o \
build/libwinpty/shared/WinptyException.o
build/libwinpty/shared/WinptyException.o \
build/libwinpty/shared/WinptyVersion.o
build/winpty.dll : $(LIBWINPTY_OBJECTS)
$(info Linking $@)

View File

@ -37,6 +37,7 @@
#include "../shared/WindowsSecurity.h"
#include "../shared/WindowsVersion.h"
#include "../shared/WinptyException.h"
#include "../shared/WinptyVersion.h"
// TODO: Error handling, handle out-of-memory.
@ -334,6 +335,7 @@ static bool verifyPipeClientPid(HANDLE serverPipe, DWORD agentPid)
WINPTY_API winpty_t *winpty_open(int cols, int rows)
{
dumpWindowsVersion();
dumpVersionToTrace();
winpty_t *pc = new winpty_t;

View File

@ -22,6 +22,8 @@
#include <stdio.h>
#include "DebugClient.h"
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
@ -29,3 +31,10 @@ void dumpVersionToStdout() {
printf("winpty version %s%s\n", STRINGIFY(WINPTY_VERSION), STRINGIFY(WINPTY_VERSION_SUFFIX));
printf("commit %s\n", STRINGIFY(WINPTY_COMMIT_HASH));
}
void dumpVersionToTrace() {
trace("winpty version %s%s (commit %s)",
STRINGIFY(WINPTY_VERSION),
STRINGIFY(WINPTY_VERSION_SUFFIX),
STRINGIFY(WINPTY_COMMIT_HASH));
}

View File

@ -22,5 +22,6 @@
#define WINPTY_VERSION_H
void dumpVersionToStdout();
void dumpVersionToTrace();
#endif // WINPTY_VERSION_H

View File

@ -144,6 +144,8 @@
'shared/WinptyAssert.cc',
'shared/WinptyException.h',
'shared/WinptyException.cc',
'shared/WinptyVersion.h',
'shared/WinptyVersion.cc',
'shared/winpty_snprintf.h',
],
},