From: greatim Date: Mon, 5 Aug 2013 17:16:36 +0000 (+0900) Subject: [Title] fix file probe bug X-Git-Tag: 2.2.1_release~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f85895b69dcd002cd286ead59e623d61574f9e5;p=framework%2Fsystem%2Fdynamic-analysis-probe.git [Title] fix file probe bug [Desc.] [Issue] Change-Id: I519044ce9abff0ef1d9ce3cb2723a6eb0c71764d --- diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c index 78f707b..0e6339f 100755 --- a/helper/libdaprobe.c +++ b/helper/libdaprobe.c @@ -45,6 +45,7 @@ #include // for sockaddr_un #include // for timerfd +#include #include "probeinfo.h" #include "dautil.h" #include "dahelper.h" @@ -276,7 +277,7 @@ static void* recvThread(void* data) } else if(log.type == MSG_STOP) { - exit(0); + app_efl_exit(); } else { diff --git a/include/dahelper.h b/include/dahelper.h index 9d4fc66..a3f59fd 100755 --- a/include/dahelper.h +++ b/include/dahelper.h @@ -69,7 +69,6 @@ extern "C"{ #define SCREENSHOT_LOCK() \ do { \ int old; \ - LOG("screenshot_lock : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ old = gTraceInfo.screenshot.state; \ gTraceInfo.screenshot.state = -1; \ @@ -82,7 +81,6 @@ extern "C"{ #define SCREENSHOT_UNLOCK() \ do { \ - LOG("screenshot_unlock : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ if(gTraceInfo.screenshot.state < 0) \ gTraceInfo.screenshot.state = 1; \ @@ -92,7 +90,6 @@ extern "C"{ #define SCREENSHOT_SET() \ do { \ int old; \ - LOG("screenshot_set : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ old = gTraceInfo.screenshot.state; \ if(gTraceInfo.screenshot.state >= 0) \ @@ -106,7 +103,6 @@ extern "C"{ #define SCREENSHOT_UNSET() \ do { \ - LOG("screenshot_unset : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ if(gTraceInfo.screenshot.state >= 0) \ gTraceInfo.screenshot.state = 0; \ @@ -116,7 +112,6 @@ extern "C"{ #define SCREENSHOT_DONE() \ do { \ int old; \ - LOG("screenshot_done : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ old = gTraceInfo.screenshot.state; \ if(gTraceInfo.screenshot.state == 1) \ @@ -130,7 +125,6 @@ extern "C"{ #define SCREENSHOT_TIMEOUT() \ do { \ int old; \ - LOG("screenshot_timeout : %d, %s\n", gTraceInfo.screenshot.state, __func__); \ pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \ old = gTraceInfo.screenshot.state; \ if(gTraceInfo.screenshot.state == 2) \ diff --git a/probe_badaapi/bada_file.cpp b/probe_badaapi/bada_file.cpp index cfa3150..dab2a11 100755 --- a/probe_badaapi/bada_file.cpp +++ b/probe_badaapi/bada_file.cpp @@ -50,7 +50,7 @@ result File::Construct(const Tizen::Base::String& filePath, bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!Constructp) { probeBlockStart(); @@ -87,9 +87,9 @@ result File::Construct(const Tizen::Base::String& filePath, log.length += sprintf(log.data + log.length,", %s",temp); log.length += sprintf(log.data + log.length,", %s`,%ld",(createParentDirectories == 0 ? "false" : "true"),ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(ret == E_SUCCESS && E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,filePath.GetPointer()); - size = attr.GetFileSize(); // WcharToChar(temp,this->GetName().GetPointer()); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,size,temp); //callstack @@ -111,155 +111,6 @@ result File::Construct(const Tizen::Base::String& filePath, return ret; } -/* deprecated apis -result File::Construct(const Tizen::Base::String& filePath, - const Tizen::Base::String& openMode, bool secureMode, - bool createParentDirectories) { - typedef result (File::*methodType)(const Tizen::Base::String& filePath, - const Tizen::Base::String& openMode, bool secureMode, - bool createParentDirectories); - static methodType Constructp = 0; - result ret; - probeInfo_t probeInfo; - log_t log; - int blockresult; - bool bfiltering = true; - char temp[50]; - //FileAttributes attr; - - if (!Constructp) { - probeBlockStart(); - - void *tmpPtr = dlsym(RTLD_NEXT, - "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bb"); - - if (tmpPtr == NULL || dlerror() != NULL) { - perror("dlsym failed : Tizen::Io::File::Construct"); - exit(0); - } - - memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr)); - probeBlockEnd(); - } - - if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) { - setProbePoint(&probeInfo); - preBlockEnd(); - } - - ret = (this->*Constructp)(filePath, openMode, secureMode, - createParentDirectories); - - if(postBlockBegin(blockresult)) { - log.type = 0; - log.length = 0; - log.data[0] = '\0'; - log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", - LC_RESOURCE, probeInfo.eventIndex, "File::Construct", - probeInfo.currentTime, probeInfo.pID, probeInfo.tID); - //Input,ret - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,%s",temp); - WcharToChar(temp,openMode.GetPointer()); - log.length += sprintf(log.data + log.length,", %s",temp); - log.length += sprintf(log.data + log.length,", %s,%s`,%ld",(secureMode == 0 ? "false" : "true"),(createParentDirectories == 0 ? "false" : "true"),ret); - //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - //File::GetAttributes(this->GetName(),attr); - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp); - //callstack - - // if(E_SUCCESS != ret || blockresult == 2) { -// log.length += sprintf(log.data + log.length, -// "`,\ncallstack_start`,`,callstack_end"); -// } else{ - log.length += sprintf(log.data + log.length, - "`,\ncallstack_start`,"); - getBacktraceString(&log, 4096 - log.length - 17); - log.length += sprintf(log.data + log.length, "`,callstack_end"); -// } - - printLog(&log, MSG_LOG); - postBlockEnd(); - } - - return ret; -} - -result File::Construct(const Tizen::Base::String& filePath, - const Tizen::Base::String& openMode, bool secureMode, - const Tizen::Base::ByteBuffer& key, bool createParentDirectories) { - typedef result (File::*methodType)(const Tizen::Base::String& filePath, - const Tizen::Base::String& openMode, bool secureMode, - const Tizen::Base::ByteBuffer& key, bool createParentDirectories); - static methodType Constructp = 0; - result ret; - probeInfo_t probeInfo; - log_t log; - int blockresult; - bool bfiltering = true; - char temp[50]; - //FileAttributes attr; - - if (!Constructp) { - probeBlockStart(); - - void *tmpPtr = dlsym(RTLD_NEXT, - "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_bRKNS2_10ByteBufferEb"); - - if (tmpPtr == NULL || dlerror() != NULL) { - perror("dlsym failed : Tizen::Io::File::Construct"); - exit(0); - } - - memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr)); - probeBlockEnd(); - } - - if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) { - setProbePoint(&probeInfo); - preBlockEnd(); - } - - ret = (this->*Constructp)(filePath, openMode, secureMode, key, - createParentDirectories); - - if(postBlockBegin(blockresult)) { - log.type = 0; - log.length = 0; - log.data[0] = '\0'; - log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", - LC_RESOURCE, probeInfo.eventIndex, "File::Construct", - probeInfo.currentTime, probeInfo.pID, probeInfo.tID); - //Input,ret - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,%s",temp); - WcharToChar(temp,openMode.GetPointer()); - log.length += sprintf(log.data + log.length,", %s",temp); - log.length += sprintf(log.data + log.length,", %s,0x%x,%s`,%ld",(secureMode == 0 ? "false" : "true"),(unsigned int)&key,(createParentDirectories == 0 ? "false" : "true"),ret); - //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - //File::GetAttributes(this->GetName(),attr); - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp); - //callstack - - // if(E_SUCCESS != ret || blockresult == 2) { -// log.length += sprintf(log.data + log.length, -// "`,\ncallstack_start`,`,callstack_end"); -// } else{ - log.length += sprintf(log.data + log.length, - "`,\ncallstack_start`,"); - getBacktraceString(&log, 4096 - log.length - 17); - log.length += sprintf(log.data + log.length, "`,callstack_end"); -// } - - printLog(&log, MSG_LOG); - postBlockEnd(); - } - - return ret; -} -*/ result File::Construct(const Tizen::Base::String& filePath, const Tizen::Base::String& openMode) { typedef result (File::*methodType)(const Tizen::Base::String& filePath, @@ -272,7 +123,7 @@ result File::Construct(const Tizen::Base::String& filePath, bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if(!Constructp) { probeBlockStart(); @@ -308,9 +159,9 @@ result File::Construct(const Tizen::Base::String& filePath, WcharToChar(temp,openMode.GetPointer()); log.length += sprintf(log.data + log.length,", %s`,%ld",temp,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(ret == E_SUCCESS && E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,filePath.GetPointer()); - size = attr.GetFileSize(); // WcharToChar(temp,this->GetName().GetPointer()); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,size,temp); //callstack @@ -332,80 +183,6 @@ result File::Construct(const Tizen::Base::String& filePath, return ret; } -/* deprecated apis -result File::Construct(const Tizen::Base::String& filePath, - const Tizen::Base::String& openMode, - const Tizen::Base::ByteBuffer& secretKey) { - typedef result (File::*methodType)(const Tizen::Base::String& filePath, - const Tizen::Base::String &openMode, - const Tizen::Base::ByteBuffer& secretKey); - static methodType Constructp = 0; - result ret; - probeInfo_t probeInfo; - log_t log; - int blockresult; - bool bfiltering = true; - char temp[50]; - //FileAttributes attr; - - if(!Constructp) { - probeBlockStart(); - - void *tmpPtr = dlsym(RTLD_NEXT, - "_ZN5Tizen2Io4File9ConstructERKNS_4Base6StringES5_RKNS2_10ByteBufferE"); - - if(tmpPtr == NULL || dlerror() != NULL) { - perror("dlsym failed : Tizen::Io::File::Construct"); - exit(0); - } - - memcpy(&Constructp, &tmpPtr, sizeof(tmpPtr)); - probeBlockEnd(); - } - - if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) { - setProbePoint(&probeInfo); - preBlockEnd(); - } - - ret = (this->*Constructp)(filePath, openMode, secretKey); - - if(postBlockBegin(blockresult)) { - log.type = 0; - log.length = 0; - log.data[0] = '\0'; - log.length = sprintf(log.data, "%d`,%d`,%s`,%lu`,%d`,%d", - LC_RESOURCE, probeInfo.eventIndex, "File::Construct", - probeInfo.currentTime, probeInfo.pID, probeInfo.tID); - //Input,ret - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,%s",temp); - WcharToChar(temp,openMode.GetPointer()); - log.length += sprintf(log.data + log.length,", %s",temp); - log.length += sprintf(log.data + log.length,", 0x%x`,%ld",(unsigned int)&secretKey,ret); - //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - //File::GetAttributes(this->GetName(),attr); - WcharToChar(temp,filePath.GetPointer()); - log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,?`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,temp); - //callstack - -// if(E_SUCCESS != ret || blockresult == 2) { -// log.length += sprintf(log.data + log.length, -// "`,\ncallstack_start`,`,callstack_end"); -// } else{ - log.length += sprintf(log.data + log.length, - "`,\ncallstack_start`,"); - getBacktraceString(&log, 4096 - log.length - 17); - log.length += sprintf(log.data + log.length, "`,callstack_end"); -// } - - printLog(&log, MSG_LOG); - postBlockEnd(); - } - - return ret; -} -*/ result File::Construct(const Tizen::Base::String& filePath, const char *pOpenMode) { typedef result (File::*methodType)(const Tizen::Base::String& filePath, @@ -418,7 +195,7 @@ result File::Construct(const Tizen::Base::String& filePath, bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if(!Constructp) { probeBlockStart(); @@ -453,9 +230,9 @@ result File::Construct(const Tizen::Base::String& filePath, log.length += sprintf(log.data + log.length,"`,%s",temp); log.length += sprintf(log.data + log.length,", %s`,%ld",pOpenMode,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(ret == E_SUCCESS && E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,filePath.GetPointer()); - size = attr.GetFileSize(); // WcharToChar(temp,this->GetName().GetPointer()); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,size,temp); //callstack @@ -491,7 +268,7 @@ result File::Construct(const Tizen::Base::String& filePath, bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if(!Constructp) { probeBlockStart(); @@ -528,9 +305,9 @@ result File::Construct(const Tizen::Base::String& filePath, log.length += sprintf(log.data + log.length,", %s",pOpenMode); log.length += sprintf(log.data + log.length,", 0x%x`,%ld",(unsigned int)&secretKey,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(ret == E_SUCCESS && E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,filePath.GetPointer()); - size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OPEN,size,temp); //callstack @@ -561,7 +338,7 @@ result File::Flush(void) { bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!Flushp) { probeBlockStart(); @@ -594,9 +371,9 @@ result File::Flush(void) { //Input,ret log.length += sprintf(log.data + log.length,"`,`,%ld",ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,size,temp); //callstack @@ -627,7 +404,7 @@ Tizen::Base::String File::GetName(void) const{ bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!GetNamep) { probeBlockStart(); @@ -662,8 +439,8 @@ Tizen::Base::String File::GetName(void) const{ WcharToChar(temp,ret.GetPointer()); log.length += sprintf(log.data + log.length,"`,`,%s",temp); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); - size = attr.GetFileSize(); + if(E_SUCCESS == File::GetAttributes(ret,attr)) + size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,size,temp); //callstack @@ -695,7 +472,7 @@ result File::Read(Tizen::Base::String& buffer) { char temp[50]; int nRead = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Readp) { probeBlockStart(); @@ -729,9 +506,9 @@ result File::Read(Tizen::Base::String& buffer) { //Input,ret log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); nRead = buffer.GetLength(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,size,temp); //callstack @@ -764,7 +541,7 @@ result File::Read(Tizen::Base::ByteBuffer& buffer) { char temp[50]; int nRead = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Readp) { probeBlockStart(); @@ -798,9 +575,9 @@ result File::Read(Tizen::Base::ByteBuffer& buffer) { //Input,ret log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); buffer.GetInt(nRead); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,size,temp); //callstack @@ -833,7 +610,7 @@ int File::Read(void *buffer, int length) { char temp[50]; int nRead = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Readp) { probeBlockStart(); @@ -868,9 +645,9 @@ int File::Read(void *buffer, int length) { //Input,ret log.length += sprintf(log.data + log.length,"`,0x%x, %d`,%d",(unsigned int)buffer,length,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); nRead = Tell() - nRead; log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,nRead,(unsigned int)this,FD_FILE,FD_API_READ,size,temp); //callstack @@ -902,7 +679,7 @@ result File::Seek(FileSeekPosition position, long offset) { bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!Seekp) { probeBlockStart(); @@ -945,9 +722,9 @@ result File::Seek(FileSeekPosition position, long offset) { log.length += sprintf(log.data + log.length,"`,%d",position); log.length += sprintf(log.data + log.length,", %ld`,%ld",offset,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,size,temp); //callstack @@ -978,7 +755,7 @@ int File::Tell(void) const { bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!Tellp) { probeBlockStart(); @@ -1013,9 +790,9 @@ int File::Tell(void) const { //Input,ret log.length += sprintf(log.data + log.length,"`,`,%d",ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",res,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,size,temp); //callstack @@ -1046,7 +823,7 @@ result File::Truncate(int length) { bool bfiltering = true; char temp[50]; FileAttributes attr; - long long size; + long long size = 0L; if (!Truncatep) { probeBlockStart(); @@ -1079,9 +856,9 @@ result File::Truncate(int length) { //Input,ret log.length += sprintf(log.data + log.length,"`,%d`,%ld",length,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,0`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,(unsigned int)this,FD_FILE,FD_API_OTHER,size,temp); //callstack @@ -1113,7 +890,7 @@ result File::Write(const void *buffer, int length) { char temp[50]; int nWritten = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Writep) { probeBlockStart(); @@ -1147,9 +924,9 @@ result File::Write(const void *buffer, int length) { //Input,ret log.length += sprintf(log.data + log.length,"`,0x%x, %d`,%ld",(unsigned int)buffer,length,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); nWritten = Tell() - nWritten; log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,size,temp); //callstack @@ -1182,7 +959,7 @@ result File::Write(const Tizen::Base::ByteBuffer& buffer) { char temp[50]; int nWritten = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Writep) { probeBlockStart(); @@ -1216,9 +993,9 @@ result File::Write(const Tizen::Base::ByteBuffer& buffer) { //Input,ret log.length += sprintf(log.data + log.length,"`,0x%x`,%ld",(unsigned int)&buffer,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); nWritten = Tell() - nWritten; log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,size,temp); //callstack @@ -1251,7 +1028,7 @@ result File::Write(const Tizen::Base::String& buffer) { char temp[50]; int nWritten = 0; FileAttributes attr; - long long size; + long long size = 0L; if (!Writep) { probeBlockStart(); @@ -1286,9 +1063,9 @@ result File::Write(const Tizen::Base::String& buffer) { WcharToChar(temp,buffer.GetPointer()); log.length += sprintf(log.data + log.length,"`,%s`,%ld",temp,ret); //PCAddr,errno,InternalCall,size,FD,FDType,FDApiType,FileSize,FilePath - File::GetAttributes(this->GetName(),attr); + if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) + size = attr.GetFileSize(); WcharToChar(temp,this->GetName().GetPointer()); - size = attr.GetFileSize(); nWritten = Tell() - nWritten; log.length += sprintf(log.data + log.length,"`,0`,%lu`,%d`,%u`,%d`,0x%x`,%d`,%d`,%lld`,%s",ret,blockresult,(unsigned int)CALLER_ADDRESS,nWritten,(unsigned int)this,FD_FILE,FD_API_WRITE,size,temp); //callstack @@ -1317,8 +1094,8 @@ File::~File(void) { int blockresult; bool bfiltering = true; void *tmpPtr; - FileAttributes attr; - long long size; +// FileAttributes attr; + long long size = 0L; if (!FileDp) { probeBlockStart(); @@ -1336,13 +1113,14 @@ File::~File(void) { if((blockresult = preBlockBegin(CALLER_ADDRESS, bfiltering, _sopt)) != 0) { setProbePoint(&probeInfo); - File::GetAttributes(this->GetName(),attr); - size = attr.GetFileSize(); + // error occur if File class was failed to contruct +// if(E_SUCCESS == File::GetAttributes(this->GetName(),attr)) +// size = attr.GetFileSize(); preBlockEnd(); } -// + (this->*FileDp)(); -// + if(postBlockBegin(blockresult)) { log.type = 0; log.length = 0;