ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
report.c File Reference

Command-line tool for crash report analysis and summarization. More...

Go to the source code of this file.

Data Structures

struct  thread_filter_list
 Owned fields extracted from one instrumentation log line. More...
struct  report_config
 Configuration for panic report generation. More...
struct  log_record
 Owned fields extracted from one instrumentation log line. More...
struct  thread_entry
 Hash table entry for thread-local last log record. More...
struct  collect_ctx_t

Macros

#define TOOLING_PANIC_REPORT_BUFFER_BUFFER_SIZE   8192

Typedefs

typedef struct thread_filter_list thread_filter_list_t
 Owned fields extracted from one instrumentation log line.
typedef struct report_config report_config_t
 Configuration for panic report generation.
typedef struct log_record log_record_t
 Owned fields extracted from one instrumentation log line.
typedef struct thread_entry thread_entry_t
 Hash table entry for thread-local last log record.

Functions

int main (int argc, char **argv)

Detailed Description

Command-line tool for crash report analysis and summarization.

Generates and summarizes crash reports from instrumentation runtime logs. Analyzes instrumentation traces to identify error patterns and provide diagnostic information.

Definition in file report.c.

Macro Definition Documentation

◆ TOOLING_PANIC_REPORT_BUFFER_BUFFER_SIZE

#define TOOLING_PANIC_REPORT_BUFFER_BUFFER_SIZE   8192

Definition at line 15 of file report.c.

Typedef Documentation

◆ log_record_t

typedef struct log_record log_record_t

Owned fields extracted from one instrumentation log line.

The record keeps process/thread identity, ordering, elapsed time, source location, and message text in separate fields so panic reporting can filter and format entries without reparsing the original line. String fields are allocated by the parser and released with the record.

◆ report_config_t

Configuration for panic report generation.

◆ thread_entry_t

typedef struct thread_entry thread_entry_t

Hash table entry for thread-local last log record.

Used by uthash to track the most recent log record for each thread when generating panic reports.

◆ thread_filter_list_t

Owned fields extracted from one instrumentation log line.

Configuration for panic report generation

Dynamic array of thread IDs for filtering instrumentation logs

Hash table entry for thread-local last log record

Dynamic array of thread IDs for filtering instrumentation logs

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 599 of file report.c.

599 {
600 report_config_t config = {
601 .log_dir = NULL,
602 .log_file = NULL,
603 .include_filter = NULL,
604 .exclude_filter = NULL,
605 .threads = {.values = NULL, .count = 0, .capacity = 0},
606 .emit_raw_line = false,
607 };
608
609 log_init(NULL, LOG_INFO, false, false);
610
611 int exit_code = EXIT_SUCCESS;
612 if (!parse_arguments(argc, argv, &config)) {
613 exit_code = config.help_requested ? EXIT_SUCCESS : ERROR_USAGE;
614 goto cleanup;
615 }
616
617 thread_entry_t *entries = NULL;
618 if (!collect_entries(&config, &entries)) {
619 exit_code = ERROR_GENERAL;
620 destroy_entries(&entries);
621 goto cleanup;
622 }
623
624 print_summary(&config, &entries);
625 destroy_entries(&entries);
626
627cleanup:
628 thread_filter_list_destroy(&config.threads);
629 log_destroy();
630 return exit_code;
631}
@ ERROR_GENERAL
Definition error_codes.h:51
@ ERROR_USAGE
Definition error_codes.h:52
void log_destroy(void)
Destroy the logging system and close log file.
void log_init(const char *filename, log_level_t level, bool force_stderr, bool use_mmap)
Initialize the logging system.
struct report_config report_config_t
Configuration for panic report generation.
struct thread_entry thread_entry_t
Hash table entry for thread-local last log record.
bool help_requested
Help was requested without a usage error.
Definition report.c:62
thread_filter_list_t threads
Thread IDs to include in report.
Definition report.c:61
#define LOG_INFO
Definition types.h:44

References ERROR_GENERAL, ERROR_USAGE, report_config::help_requested, log_destroy(), LOG_INFO, log_init(), and report_config::threads.