mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 22:00:05 +00:00 
			
		
		
		
	service/err_f: Migrate logging macros (#3849)
* service/err_f: Migrate logging macros * service/err_f: Added static_cast<u32>
This commit is contained in:
		
							parent
							
								
									964602dfcb
								
							
						
					
					
						commit
						831e3a0b54
					
				
					 1 changed files with 42 additions and 43 deletions
				
			
		|  | @ -132,30 +132,30 @@ static std::string GetCurrentSystemTime() { | |||
| } | ||||
| 
 | ||||
| static void LogGenericInfo(const ErrInfo::ErrInfoCommon& errinfo_common) { | ||||
|     LOG_CRITICAL(Service_ERR, "PID: 0x%08X", errinfo_common.pid); | ||||
|     LOG_CRITICAL(Service_ERR, "REV: 0x%08X_0x%08X", errinfo_common.rev_high, | ||||
|                  errinfo_common.rev_low); | ||||
|     LOG_CRITICAL(Service_ERR, "TID: 0x%08X_0x%08X", errinfo_common.title_id_high, | ||||
|                  errinfo_common.title_id_low); | ||||
|     LOG_CRITICAL(Service_ERR, "AID: 0x%08X_0x%08X", errinfo_common.app_title_id_high, | ||||
|                  errinfo_common.app_title_id_low); | ||||
|     LOG_CRITICAL(Service_ERR, "ADR: 0x%08X", errinfo_common.pc_address); | ||||
|     NGLOG_CRITICAL(Service_ERR, "PID: 0x{:08X}", errinfo_common.pid); | ||||
|     NGLOG_CRITICAL(Service_ERR, "REV: 0x{:08X}_0x{:08X}", errinfo_common.rev_high, | ||||
|                    errinfo_common.rev_low); | ||||
|     NGLOG_CRITICAL(Service_ERR, "TID: 0x{:08X}_0x{:08X}", errinfo_common.title_id_high, | ||||
|                    errinfo_common.title_id_low); | ||||
|     NGLOG_CRITICAL(Service_ERR, "AID: 0x{:08X}_0x{:08X}", errinfo_common.app_title_id_high, | ||||
|                    errinfo_common.app_title_id_low); | ||||
|     NGLOG_CRITICAL(Service_ERR, "ADR: 0x{:08X}", errinfo_common.pc_address); | ||||
| 
 | ||||
|     ResultCode result_code{errinfo_common.result_code}; | ||||
|     LOG_CRITICAL(Service_ERR, "RSL: 0x%08X", result_code.raw); | ||||
|     LOG_CRITICAL(Service_ERR, "  Level: %u", result_code.level.Value()); | ||||
|     LOG_CRITICAL(Service_ERR, "  Summary: %u", result_code.summary.Value()); | ||||
|     LOG_CRITICAL(Service_ERR, "  Module: %u", result_code.module.Value()); | ||||
|     LOG_CRITICAL(Service_ERR, "  Desc: %u", result_code.description.Value()); | ||||
|     NGLOG_CRITICAL(Service_ERR, "RSL: 0x{:08X}", result_code.raw); | ||||
|     NGLOG_CRITICAL(Service_ERR, "  Level: {}", static_cast<u32>(result_code.level.Value())); | ||||
|     NGLOG_CRITICAL(Service_ERR, "  Summary: {}", static_cast<u32>(result_code.summary.Value())); | ||||
|     NGLOG_CRITICAL(Service_ERR, "  Module: {}", static_cast<u32>(result_code.module.Value())); | ||||
|     NGLOG_CRITICAL(Service_ERR, "  Desc: {}", static_cast<u32>(result_code.description.Value())); | ||||
| } | ||||
| 
 | ||||
| void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestParser rp(ctx, 1, 32, 0); | ||||
| 
 | ||||
|     LOG_CRITICAL(Service_ERR, "Fatal error"); | ||||
|     NGLOG_CRITICAL(Service_ERR, "Fatal error"); | ||||
|     const ErrInfo errinfo = rp.PopRaw<ErrInfo>(); | ||||
|     LOG_CRITICAL(Service_ERR, "Fatal error type: %s", | ||||
|                  GetErrType(errinfo.errinfo_common.specifier).c_str()); | ||||
|     NGLOG_CRITICAL(Service_ERR, "Fatal error type: {}", | ||||
|                    GetErrType(errinfo.errinfo_common.specifier)); | ||||
|     Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorUnknown); | ||||
| 
 | ||||
|     // Generic Info
 | ||||
|  | @ -166,57 +166,56 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) { | |||
|     case FatalErrType::Corrupted: | ||||
|     case FatalErrType::CardRemoved: | ||||
|     case FatalErrType::Logged: { | ||||
|         LOG_CRITICAL(Service_ERR, "Datetime: %s", GetCurrentSystemTime().c_str()); | ||||
|         NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime()); | ||||
|         break; | ||||
|     } | ||||
|     case FatalErrType::Exception: { | ||||
|         const auto& errtype = errinfo.exception; | ||||
| 
 | ||||
|         // Register Info
 | ||||
|         LOG_CRITICAL(Service_ERR, "ARM Registers:"); | ||||
|         NGLOG_CRITICAL(Service_ERR, "ARM Registers:"); | ||||
|         for (u32 index = 0; index < errtype.exception_data.exception_context.arm_regs.size(); | ||||
|              ++index) { | ||||
|             if (index < 13) { | ||||
|                 LOG_DEBUG(Service_ERR, "r%u=0x%08X", index, | ||||
|                           errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|                 NGLOG_DEBUG(Service_ERR, "r{}=0x{:08X}", index, | ||||
|                             errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|             } else if (index == 13) { | ||||
|                 LOG_CRITICAL(Service_ERR, "SP=0x%08X", | ||||
|                              errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|                 NGLOG_CRITICAL(Service_ERR, "SP=0x{:08X}", | ||||
|                                errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|             } else if (index == 14) { | ||||
|                 LOG_CRITICAL(Service_ERR, "LR=0x%08X", | ||||
|                              errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|                 NGLOG_CRITICAL(Service_ERR, "LR=0x{:08X}", | ||||
|                                errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|             } else if (index == 15) { | ||||
|                 LOG_CRITICAL(Service_ERR, "PC=0x%08X", | ||||
|                              errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|                 NGLOG_CRITICAL(Service_ERR, "PC=0x{:08X}", | ||||
|                                errtype.exception_data.exception_context.arm_regs.at(index)); | ||||
|             } | ||||
|         } | ||||
|         LOG_CRITICAL(Service_ERR, "CPSR=0x%08X", errtype.exception_data.exception_context.cpsr); | ||||
|         NGLOG_CRITICAL(Service_ERR, "CPSR=0x{:08X}", errtype.exception_data.exception_context.cpsr); | ||||
| 
 | ||||
|         // Exception Info
 | ||||
|         LOG_CRITICAL( | ||||
|             Service_ERR, "EXCEPTION TYPE: %s", | ||||
|             GetExceptionType(errtype.exception_data.exception_info.exception_type).c_str()); | ||||
|         NGLOG_CRITICAL(Service_ERR, "EXCEPTION TYPE: {}", | ||||
|                        GetExceptionType(errtype.exception_data.exception_info.exception_type)); | ||||
|         switch (static_cast<ExceptionType>(errtype.exception_data.exception_info.exception_type)) { | ||||
|         case ExceptionType::PrefetchAbort: | ||||
|             LOG_CRITICAL(Service_ERR, "IFSR: 0x%08X", errtype.exception_data.exception_info.sr); | ||||
|             LOG_CRITICAL(Service_ERR, "r15: 0x%08X", errtype.exception_data.exception_info.ar); | ||||
|             NGLOG_CRITICAL(Service_ERR, "IFSR: 0x{:08X}", errtype.exception_data.exception_info.sr); | ||||
|             NGLOG_CRITICAL(Service_ERR, "r15: 0x{:08X}", errtype.exception_data.exception_info.ar); | ||||
|             break; | ||||
|         case ExceptionType::DataAbort: | ||||
|             LOG_CRITICAL(Service_ERR, "DFSR: 0x%08X", errtype.exception_data.exception_info.sr); | ||||
|             LOG_CRITICAL(Service_ERR, "DFAR: 0x%08X", errtype.exception_data.exception_info.ar); | ||||
|             NGLOG_CRITICAL(Service_ERR, "DFSR: 0x{:08X}", errtype.exception_data.exception_info.sr); | ||||
|             NGLOG_CRITICAL(Service_ERR, "DFAR: 0x{:08X}", errtype.exception_data.exception_info.ar); | ||||
|             break; | ||||
|         case ExceptionType::VectorFP: | ||||
|             LOG_CRITICAL(Service_ERR, "FPEXC: 0x%08X", | ||||
|                          errtype.exception_data.exception_info.fpinst); | ||||
|             LOG_CRITICAL(Service_ERR, "FINST: 0x%08X", | ||||
|                          errtype.exception_data.exception_info.fpinst); | ||||
|             LOG_CRITICAL(Service_ERR, "FINST2: 0x%08X", | ||||
|                          errtype.exception_data.exception_info.fpinst2); | ||||
|             NGLOG_CRITICAL(Service_ERR, "FPEXC: 0x{:08X}", | ||||
|                            errtype.exception_data.exception_info.fpinst); | ||||
|             NGLOG_CRITICAL(Service_ERR, "FINST: 0x{:08X}", | ||||
|                            errtype.exception_data.exception_info.fpinst); | ||||
|             NGLOG_CRITICAL(Service_ERR, "FINST2: 0x{:08X}", | ||||
|                            errtype.exception_data.exception_info.fpinst2); | ||||
|             break; | ||||
|         case ExceptionType::Undefined: | ||||
|             break; // Not logging exception_info for this case
 | ||||
|         } | ||||
|         LOG_CRITICAL(Service_ERR, "Datetime: %s", GetCurrentSystemTime().c_str()); | ||||
|         NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime()); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|  | @ -224,8 +223,8 @@ void ERR_F::ThrowFatalError(Kernel::HLERequestContext& ctx) { | |||
|         const auto& errtype = errinfo.result_failure; | ||||
| 
 | ||||
|         // Failure Message
 | ||||
|         LOG_CRITICAL(Service_ERR, "Failure Message: %s", errtype.message); | ||||
|         LOG_CRITICAL(Service_ERR, "Datetime: %s", GetCurrentSystemTime().c_str()); | ||||
|         NGLOG_CRITICAL(Service_ERR, "Failure Message: {}", errtype.message); | ||||
|         NGLOG_CRITICAL(Service_ERR, "Datetime: {}", GetCurrentSystemTime()); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue