memana/analyzetoolclient/commandlineengine/internal/inc/cataddr2lineserver.h
author Matti Laitinen <matti.t.laitinen@nokia.com>
Thu, 11 Feb 2010 15:51:35 +0200
changeset 0 f0f2b8682603
permissions -rw-r--r--
Add initial version of AnalyzeTool client under EPL

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Class representing a server that uses addr2line.exe.
*
*/

#ifndef __CATADDR2LINESERVER_H__
#define __CATADDR2LINESERVER_H__

// Includes.
#include "ATCommonDefines.h"

#define BUFSIZE 4096
 
class CATAddr2lineServer
{
public:

	//Creator
	CATAddr2lineServer();
	
	//Destructor
	~CATAddr2lineServer();

	/**
	* Get function name for given address.
	* @sFullPathAndBinaryName
	* @return True if initialization succesfull.
	*/
	bool Initialize( const string& sFullPathAndBinaryName );

	/**
	* Write data to a pipe.
	* @sAddress
	*/
	VOID WriteToPipe( const string& sAddress );

	/**
	* Read data to a pipe.
	* @return Data from pipe.
	*/
	string ReadFromPipe(VOID);

	/**
	* Gets process created state.
	* @return True if process created successfully.
	*/
	bool GetProcessCreatedState( void );

#ifndef MODULE_TEST
private:
#endif

	HANDLE m_hChildStdinRd, m_hChildStdinWr, m_hChildStdinWrDup, 
	       m_hChildStdoutRd, m_hChildStdoutWr, m_hChildStdoutRdDup, 
	       m_hChildErroutRd, m_hChildErroutWr, m_hChildErroutRdDup, 
           m_hSaveStdin, m_hSaveStdout, m_hSaveErrout; 

    SECURITY_ATTRIBUTES m_saAttr;
    string m_sFullPathAndBinaryName;
	bool m_bProcessCreated;

	/**
	* Creates child process for addr2line.exe.
	* @return True if process created successfully.
	*/
	BOOL CreateChildProcess(VOID); 

	/**
	* Prints error and returns false.
	* @param sInput error string.
	* @return false.
	*/
	bool PrintErrorAndExit( const string sInput );


};
#endif