diff options
| author | Deepak Panickal <deepak@codeplay.com> | 2014-08-08 16:47:42 +0000 |
|---|---|---|
| committer | Deepak Panickal <deepak@codeplay.com> | 2014-08-08 16:47:42 +0000 |
| commit | d249928b84c2fc11b0940d702288cbf4f7f2d332 (patch) | |
| tree | 15c9c86005af89960c902e4f24513d5e173d00a6 /lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp | |
| parent | caa565887d7a8701624534516308da497ae46078 (diff) | |
| download | bcm5719-llvm-d249928b84c2fc11b0940d702288cbf4f7f2d332.tar.gz bcm5719-llvm-d249928b84c2fc11b0940d702288cbf4f7f2d332.zip | |
Add new MI commands, features and fixes to the lldb-mi driver.
- Can now load an executable directly as an argument.
- Fixes towards supporting local debugging.
- Fixes for stack-list-arguments, data-evaluate-expression, environment-cd, stack-list-locals, interpreter-exec.
- Fix breakpoint event handling.
- Support dynamic loading of libraries using the search paths provided by Eclipse.
llvm-svn: 215223
Diffstat (limited to 'lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp')
| -rw-r--r-- | lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp b/lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp index c3760adc2f5..9938deb131c 100644 --- a/lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp +++ b/lldb/tools/lldb-mi/MIUtilDateTimeStd.cpp @@ -19,12 +19,6 @@ // Copyright: None. //-- -// Include compiler configuration -#include "MICmnConfig.h" - -// Third party headers -#include <time.h> - // In-house headers: #include "MIUtilDateTimeStd.h" #include "MICmnResources.h" @@ -52,20 +46,21 @@ CMIUtilDateTimeStd::~CMIUtilDateTimeStd( void ) } //++ ------------------------------------------------------------------------------------ -// Details: Retrieve system local current date. Format is DD/MM/YYYY. +// Details: Retrieve system local current date. Format is MM/DD/YYYY. // Type: Method. // Args: None. // Return: CMIUtilString - Text description. // Throws: None. //-- -CMIUtilString CMIUtilDateTimeStd::GetDate( void ) const +CMIUtilString CMIUtilDateTimeStd::GetDate( void ) { CMIUtilString strDate( MIRSRC( IDS_WORD_INVALIDBRKTS ) ); - CMIUtilString localDate; - CMIUtilString localTime; - if( GetDateTimeShort( localDate, localTime ) ) - strDate = localDate; + std::time( &m_rawTime ); + const std::tm * pTi = std::localtime( &m_rawTime ); + if( std::strftime( &m_pScratch[ 0 ], sizeof( m_pScratch ), "%d/%m/%y", pTi ) > 0 ) + strDate = m_pScratch; + return strDate; } @@ -76,34 +71,14 @@ CMIUtilString CMIUtilDateTimeStd::GetDate( void ) const // Return: CMIUtilString - Text description. // Throws: None. //-- -CMIUtilString CMIUtilDateTimeStd::GetTime( void ) const +CMIUtilString CMIUtilDateTimeStd::GetTime( void ) { - CMIUtilString strTime( MIRSRC( IDS_WORD_INVALIDBRKTS ) ); - CMIUtilString localDate; - CMIUtilString localTime; - if( GetDateTimeShort( localDate, localTime ) ) - strTime = localTime; - + std::time( &m_rawTime ); + const std::tm * pTi = std::localtime( &m_rawTime ); + const CMIUtilString seconds( CMIUtilString::Format( "%d", pTi->tm_sec ) ); + const CMIUtilString zero( (seconds.length() == 1) ? "0" : "" ); + const CMIUtilString strTime( CMIUtilString::Format( "%d:%d:%s%s", pTi->tm_hour, pTi->tm_min, zero.c_str(), seconds.c_str() ) ); + return strTime; } -//++ ------------------------------------------------------------------------------------ -// Details: Retrieve system local time and date, short version. -// Type: Method. -// Args: vrwLocalDate - (W) Text date. Format is DD/MM/YYYY. -// vrwLocalTime - (W) Text time. Format is HH:MM:SS 24 hour clock. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. -//-- -bool CMIUtilDateTimeStd::GetDateTimeShort( CMIUtilString & vrwLocalDate, CMIUtilString & vrwLocalTime ) const -{ - time_t rawTime; - ::time( &rawTime ); - struct tm * pTi = ::localtime( &rawTime ); - - vrwLocalDate = CMIUtilString::Format( "%d/%d/%d", pTi->tm_wday, pTi->tm_mon, pTi->tm_year ); - vrwLocalTime = CMIUtilString::Format( "%d:%d:%d", pTi->tm_hour, pTi->tm_min, pTi->tm_sec ); - - return MIstatus::success; -} |

