diff options
author | Ruslan Bukin <br@FreeBSD.org> | 2019-10-10 13:19:21 +0000 |
---|---|---|
committer | Ruslan Bukin <br@FreeBSD.org> | 2019-10-10 13:19:21 +0000 |
commit | cf98ba14dc260458f757fa46419575cf69f45a44 (patch) | |
tree | 1cafc844f372337d2a95c8a416b915d46bf4daf8 /decoder/include/common | |
parent | a6157d81121ac9559d806dafa346039199598442 (diff) |
Notes
Diffstat (limited to 'decoder/include/common')
-rw-r--r-- | decoder/include/common/ocsd_code_follower.h | 6 | ||||
-rw-r--r-- | decoder/include/common/ocsd_dcd_tree.h | 22 | ||||
-rw-r--r-- | decoder/include/common/ocsd_error_logger.h | 4 | ||||
-rw-r--r-- | decoder/include/common/ocsd_msg_logger.h | 25 | ||||
-rw-r--r-- | decoder/include/common/trc_gen_elem.h | 11 |
5 files changed, 50 insertions, 18 deletions
diff --git a/decoder/include/common/ocsd_code_follower.h b/decoder/include/common/ocsd_code_follower.h index 0e8691034a68..b024aa02a368 100644 --- a/decoder/include/common/ocsd_code_follower.h +++ b/decoder/include/common/ocsd_code_follower.h @@ -95,6 +95,7 @@ public: const bool isLink() const; //!< is a link (branch with link etc) const bool ISAChanged() const; //!< next ISA different from input ISA. const ocsd_isa nextISA() const; //!< ISA for next instruction + const uint8_t getInstrSize() const; //!< Get the last instruction size. // information on error conditions const bool isNacc() const; //!< true if Memory Not Accessible (nacc) error occurred @@ -192,6 +193,11 @@ inline const ocsd_instr_subtype OcsdCodeFollower::getInstrSubType() const return m_instr_info.sub_type; } +inline const uint8_t OcsdCodeFollower::getInstrSize() const +{ + return m_instr_info.instr_size; +} + inline const bool OcsdCodeFollower::isCondInstr() const { return (bool)(m_instr_info.is_conditional == 1); diff --git a/decoder/include/common/ocsd_dcd_tree.h b/decoder/include/common/ocsd_dcd_tree.h index 496f8e5d72e0..e4e74f2bc659 100644 --- a/decoder/include/common/ocsd_dcd_tree.h +++ b/decoder/include/common/ocsd_dcd_tree.h @@ -313,6 +313,22 @@ public: */ ocsd_err_t addBinFileRegionMemAcc(const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const std::string &filepath); + + /*! + * Updates/adds to a memory accessor for a memory block supplied as a one or more memory regions in a binary file. + * Region structures are created that describe the memory start address, the offset within the binary file + * for that address, and the length of the region. This accessor can be used to point to the code section + * in a program file for example. + * + * @param *region_array : array of valid memory regions in the file. + * @param num_regions : number of regions + * @param mem_space : Memory space + * @param &filepath : Path to the binary data file + * + * @return ocsd_err_t : Library error code or OCSD_OK if successful. + */ + ocsd_err_t updateBinFileRegionMemAcc(const ocsd_file_mem_region_t *region_array, const int num_regions, const ocsd_mem_space_acc_t mem_space, const std::string &filepath); + /*! * This memory accessor allows the client to supply a callback function for the region * defined by the start and end addresses. This can be used to supply a custom memory accessor, @@ -327,7 +343,8 @@ public: * @return ocsd_err_t : Library error code or OCSD_OK if successful. */ ocsd_err_t addCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAcc_CB p_cb_func, const void *p_context); - + ocsd_err_t addCallbackIDMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, const ocsd_mem_space_acc_t mem_space, Fn_MemAccID_CB p_cb_func, const void *p_context); + /*! * Remove the memory accessor from the map, that begins at the given address, for the memory space provided. * @@ -368,6 +385,9 @@ private: ocsd_err_t createDecodeElement(const uint8_t CSID); void destroyDecodeElement(const uint8_t CSID); void destroyMemAccMapper(); + ocsd_err_t initCallbackMemAcc(const ocsd_vaddr_t st_address, const ocsd_vaddr_t en_address, + const ocsd_mem_space_acc_t mem_space, void *p_cb_func, bool IDfn, const void *p_context); + ocsd_dcd_tree_src_t m_dcd_tree_type; diff --git a/decoder/include/common/ocsd_error_logger.h b/decoder/include/common/ocsd_error_logger.h index d60139726efb..3badd337f655 100644 --- a/decoder/include/common/ocsd_error_logger.h +++ b/decoder/include/common/ocsd_error_logger.h @@ -37,7 +37,7 @@ #include <string> #include <vector> -#include <fstream> +//#include <fstream> #include "interfaces/trc_error_log_i.h" #include "ocsd_error.h" @@ -49,7 +49,7 @@ public: ocsdDefaultErrorLogger(); virtual ~ocsdDefaultErrorLogger(); - bool initErrorLogger(const ocsd_err_severity_t verbosity, bool bCreateOutputLogger = false); + bool initErrorLogger(const ocsd_err_severity_t verbosity, bool bCreateOutputLogger = false); //!< Initialise the error logger with a severity filter, optionally create an output logger on stderr. virtual ocsdMsgLogger *getOutputLogger() { return m_output_logger; }; virtual void setOutputLogger(ocsdMsgLogger *pLogger); diff --git a/decoder/include/common/ocsd_msg_logger.h b/decoder/include/common/ocsd_msg_logger.h index c40af9189aa7..d83a0224e176 100644 --- a/decoder/include/common/ocsd_msg_logger.h +++ b/decoder/include/common/ocsd_msg_logger.h @@ -53,23 +53,26 @@ public: ocsdMsgLogger(); ~ocsdMsgLogger(); + /** Typedef enum providing flags to define the output methods for the message logger. + */ typedef enum { - OUT_NONE = 0, - OUT_FILE = 1, - OUT_STDERR = 2, - OUT_STDOUT = 4, - OUT_STR_CB = 8 /* output to external string callback interface */ + OUT_NONE = 0, /*!< No output from logger*/ + OUT_FILE = 1, /*!< Output to file */ + OUT_STDERR = 2, /*!< Output to stderr */ + OUT_STDOUT = 4, /*!< Output to stdout */ + OUT_STR_CB = 8 /*!< output to external string callback interface */ } output_dest; - void setLogOpts(int logOpts); - const int getLogOpts() const { return m_outFlags; }; + void setLogOpts(int logOpts); //!< set the output logging flags. + const int getLogOpts() const //! get the current output logging flags value. + { return m_outFlags; }; - void setLogFileName(const char *fileName); - void setStrOutFn(ocsdMsgLogStrOutI *p_IstrOut); + void setLogFileName(const char *fileName); //!< Set the output log filename, and enable logging to file. + void setStrOutFn(ocsdMsgLogStrOutI *p_IstrOut); //!< Set the output log string callback and enable logging to callback. - void LogMsg(const std::string &msg); + void LogMsg(const std::string &msg); //!< Log a message to the current set output channels. - const bool isLogging() const; + const bool isLogging() const; //!< true if logging active private: int m_outFlags; diff --git a/decoder/include/common/trc_gen_elem.h b/decoder/include/common/trc_gen_elem.h index 00081b556904..1c4a47b3aa0a 100644 --- a/decoder/include/common/trc_gen_elem.h +++ b/decoder/include/common/trc_gen_elem.h @@ -73,9 +73,10 @@ public: void setTraceOnReason(const trace_on_reason_t reason); - void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr); - void setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype); + void setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr, const int num_instr = 1); + void setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype, const uint8_t size); void setAddrStart(const ocsd_vaddr_t st_addr) { this->st_addr = st_addr; }; + void setLastInstrCond(const int is_cond) { this->last_instr_cond = is_cond; }; void setSWTInfo(const ocsd_swt_info_t swt_info) { sw_trace_info = swt_info; }; void setExtendedDataPtr(const void *data_ptr); @@ -122,15 +123,17 @@ inline void OcsdTraceElement::setEvent(const event_t ev_type, const uint16_t num trace_event.ev_number = ev_type == EVENT_NUMBERED ? number : 0; } -inline void OcsdTraceElement::setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr) +inline void OcsdTraceElement::setAddrRange(const ocsd_vaddr_t st_addr, const ocsd_vaddr_t en_addr, const int num_instr /* = 1 */) { this->st_addr = st_addr; this->en_addr = en_addr; + this->num_instr_range = num_instr; } -inline void OcsdTraceElement::setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype) +inline void OcsdTraceElement::setLastInstrInfo(const bool exec, const ocsd_instr_type last_i_type, const ocsd_instr_subtype last_i_subtype, const uint8_t size) { last_instr_exec = exec ? 1 : 0; + last_instr_sz = size & 0x7; this->last_i_type = last_i_type; this->last_i_subtype = last_i_subtype; } |