Debian Codegraph @

utils/v4l2-tracer/retrace.h

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright 2022 Collabora Ltd.
4 */
5
6 #ifndef RETRACE_H
7 #define RETRACE_H
8
9 #include "v4l2-tracer-common.h"
10 #include "retrace-gen.h"
11
12 struct buffer_retrace {
13 int fd;
14 __u32 type;
15 __u32 index;
16 __u32 offset;
17 long address_trace;
18 long address_retrace;
19 };
20
21 struct retrace_context {
22 /* Key is a file descriptor from the trace, value is the corresponding fd in the retrace. */
23 std::unordered_map<int, int> retrace_fds;
24 /* List of output and capture buffers being retraced. */
25 std::list<struct buffer_retrace> buffers;
26 };
27
28 int retrace(std::string trace_filename);
29
30 bool buffer_in_retrace_context(int fd, __u32 offset = 0);
31 int get_buffer_fd_retrace(__u32 type, __u32 index);
32 void add_buffer_retrace(int fd, __u32 type, __u32 index, __u32 offset = 0);
33 void remove_buffer_retrace(__u32 type, __u32 index);
34 void set_buffer_address_retrace(int fd, __u32 offset, long address_trace, long address_retrace);
35 long get_retrace_address_from_trace_address(long address_trace);
36 void add_fd(int fd_trace, int fd_retrace);
37 int get_fd_retrace_from_fd_trace(int fd_trace);
38 std::string get_path_retrace_from_path_trace(std::string path_trace, json_object *jobj);
39 void write_to_output_buffer(unsigned char *buffer_pointer, int bytesused, json_object *mem_obj);
40 void compare_program_versions(json_object *v4l2_tracer_info_obj);
41 void print_context(void);
42
43 #endif