analyzetool/commandlineengine/inc/cataddr2lineserver.h
branchRCL_3
changeset 13 da2cedce4920
equal deleted inserted replaced
12:d27dfa8884ad 13:da2cedce4920
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Defines CATAddr2lineServer class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CATADDR2LINESERVER_H__
       
    19 #define __CATADDR2LINESERVER_H__
       
    20 
       
    21 // Includes.
       
    22 #include "ATCommonDefines.h"
       
    23 
       
    24 #define BUFSIZE 4096
       
    25  
       
    26 /**
       
    27 * This class "runs" the addr2line binary as a server for CATAddr2Line.
       
    28 * It redirects the pipes from the tool.
       
    29 */
       
    30 class CATAddr2lineServer
       
    31 {
       
    32 public:
       
    33 
       
    34 	//Creator
       
    35 	CATAddr2lineServer();
       
    36 	
       
    37 	//Destructor
       
    38 	~CATAddr2lineServer();
       
    39 
       
    40 	/**
       
    41 	* Get function name for given address.
       
    42 	* @sFullPathAndBinaryName
       
    43 	* @return True if initialization succesfull.
       
    44 	*/
       
    45 	bool Initialize( const string& sFullPathAndBinaryName );
       
    46 
       
    47 	/**
       
    48 	* Write data to a pipe.
       
    49 	* @sAddress
       
    50 	*/
       
    51 	VOID WriteToPipe( const string& sAddress );
       
    52 
       
    53 	/**
       
    54 	* Read data to a pipe.
       
    55 	* @return Data from pipe.
       
    56 	*/
       
    57 	string ReadFromPipe(VOID);
       
    58 
       
    59 	/**
       
    60 	* Gets process created state.
       
    61 	* @return True if process created successfully.
       
    62 	*/
       
    63 	bool GetProcessCreatedState( void );
       
    64 
       
    65 #ifndef MODULE_TEST
       
    66 private:
       
    67 #endif
       
    68 
       
    69 	HANDLE m_hChildStdinRd, m_hChildStdinWr, m_hChildStdinWrDup, 
       
    70 	       m_hChildStdoutRd, m_hChildStdoutWr, m_hChildStdoutRdDup, 
       
    71 	       m_hChildErroutRd, m_hChildErroutWr, m_hChildErroutRdDup, 
       
    72            m_hSaveStdin, m_hSaveStdout, m_hSaveErrout; 
       
    73 
       
    74     SECURITY_ATTRIBUTES m_saAttr;
       
    75     string m_sFullPathAndBinaryName;
       
    76 	bool m_bProcessCreated;
       
    77 
       
    78 	/**
       
    79 	* Creates child process for addr2line.exe.
       
    80 	* @return True if process created successfully.
       
    81 	*/
       
    82 	BOOL CreateChildProcess(VOID); 
       
    83 
       
    84 	/**
       
    85 	* Prints error and returns false.
       
    86 	* @param sInput error string.
       
    87 	* @return false.
       
    88 	*/
       
    89 	bool PrintErrorAndExit( const string sInput );
       
    90 
       
    91 
       
    92 };
       
    93 #endif