summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/x86log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/x86log.h')
-rw-r--r--src/devices/cpu/x86log.h106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/devices/cpu/x86log.h b/src/devices/cpu/x86log.h
index 82a8990b59e..ac7195c99bd 100644
--- a/src/devices/cpu/x86log.h
+++ b/src/devices/cpu/x86log.h
@@ -35,34 +35,34 @@ constexpr int COMMENT_POOL_SIZE{MAX_COMMENTS * 40};
/* code logging info */
struct log_comment
{
- x86code* base;
- const char* string;
+ x86code* base;
+ const char* string;
};
/* data ranges */
struct data_range_t
{
- x86code* base;
- x86code* end;
- int size;
+ x86code* base;
+ x86code* end;
+ int size;
};
/* the code logging context */
struct x86log_context
{
- std::string filename; /* name of the file */
- FILE* file; /* file we are logging to */
+ std::string filename; /* name of the file */
+ FILE* file; /* file we are logging to */
- data_range_t data_range[MAX_DATA_RANGES]; /* list of data ranges */
- int data_range_count; /* number of data ranges */
+ data_range_t data_range[MAX_DATA_RANGES]; /* list of data ranges */
+ int data_range_count; /* number of data ranges */
- log_comment comment_list[MAX_COMMENTS]; /* list of comments */
- int comment_count; /* number of live comments */
+ log_comment comment_list[MAX_COMMENTS]; /* list of comments */
+ int comment_count; /* number of live comments */
- char comment_pool[COMMENT_POOL_SIZE]; /* string pool to hold comments */
- char* comment_pool_next; /* pointer to next string pool location */
+ char comment_pool[COMMENT_POOL_SIZE]; /* string pool to hold comments */
+ char* comment_pool_next; /* pointer to next string pool location */
};
@@ -80,15 +80,15 @@ void x86log_free_context(x86log_context* log) noexcept;
/* add a comment associated with a given code pointer */
template <typename... Ts>
inline void x86log_add_comment(
- x86log_context* log, x86code* base, const char* format, Ts&&... xs);
+ x86log_context* log, x86code* base, const char* format, Ts&&... xs);
/* mark a given range as data for logging purposes */
void x86log_mark_as_data(
- x86log_context* log, x86code* base, x86code* end, int size) noexcept;
+ x86log_context* log, x86code* base, x86code* end, int size) noexcept;
/* disassemble a range of code and reset accumulated information */
void x86log_disasm_code_range(
- x86log_context* log, const char* label, x86code* start, x86code* stop);
+ x86log_context* log, const char* label, x86code* start, x86code* stop);
/* manually printf information to the log file */
template <typename... Ts>
@@ -102,33 +102,33 @@ inline void x86log_printf(x86log_context* log, const char* format, Ts&&... xs);
template <typename... Ts>
inline void x86log_add_comment(
- x86log_context* log, x86code* base, const char* format, Ts&&... xs)
+ x86log_context* log, x86code* base, const char* format, Ts&&... xs)
{
- char* string = log->comment_pool_next;
- log_comment* comment;
-
- assert(log->comment_count < MAX_COMMENTS);
- assert(log->comment_pool_next + strlen(format) + 256 <
- log->comment_pool + COMMENT_POOL_SIZE);
-
- /* we assume comments are registered in order; enforce this */
- assert(log->comment_count == 0 ||
- base >= log->comment_list[log->comment_count - 1].base);
-
- /* if we exceed the maxima, skip it */
- if(log->comment_count >= MAX_COMMENTS) return;
- if(log->comment_pool_next + strlen(format) + 256 >=
- log->comment_pool + COMMENT_POOL_SIZE)
- return;
-
- /* do the printf to the string pool */
- log->comment_pool_next +=
- sprintf(log->comment_pool_next, format, std::forward<Ts>(xs)...) + 1;
-
- /* fill in the new comment */
- comment = &log->comment_list[log->comment_count++];
- comment->base = base;
- comment->string = string;
+ char* string = log->comment_pool_next;
+ log_comment* comment;
+
+ assert(log->comment_count < MAX_COMMENTS);
+ assert(log->comment_pool_next + strlen(format) + 256 <
+ log->comment_pool + COMMENT_POOL_SIZE);
+
+ /* we assume comments are registered in order; enforce this */
+ assert(log->comment_count == 0 ||
+ base >= log->comment_list[log->comment_count - 1].base);
+
+ /* if we exceed the maxima, skip it */
+ if(log->comment_count >= MAX_COMMENTS) return;
+ if(log->comment_pool_next + strlen(format) + 256 >=
+ log->comment_pool + COMMENT_POOL_SIZE)
+ return;
+
+ /* do the printf to the string pool */
+ log->comment_pool_next +=
+ sprintf(log->comment_pool_next, format, std::forward<Ts>(xs)...) + 1;
+
+ /* fill in the new comment */
+ comment = &log->comment_list[log->comment_count++];
+ comment->base = base;
+ comment->string = string;
}
@@ -140,21 +140,21 @@ inline void x86log_add_comment(
template <typename... Ts>
inline void x86log_printf(x86log_context* log, const char* format, Ts&&... xs)
{
- /* open the file, creating it if necessary */
- if(log->file == nullptr)
- {
- log->file = fopen(log->filename.c_str(), "w");
+ /* open the file, creating it if necessary */
+ if(log->file == nullptr)
+ {
+ log->file = fopen(log->filename.c_str(), "w");
- if(log->file == nullptr) return;
- }
+ if(log->file == nullptr) return;
+ }
- assert(log->file != nullptr);
+ assert(log->file != nullptr);
- /* do the printf */
- fprintf(log->file, format, std::forward<Ts>(xs)...);
+ /* do the printf */
+ fprintf(log->file, format, std::forward<Ts>(xs)...);
- /* flush the file */
- fflush(log->file);
+ /* flush the file */
+ fflush(log->file);
}
#endif /* __X86LOG_H__ */