Linux Perf
code-reading.c File Reference
#include <errno.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/param.h>
#include "parse-events.h"
#include "evlist.h"
#include "evsel.h"
#include "thread_map.h"
#include "cpumap.h"
#include "machine.h"
#include "event.h"
#include "thread.h"
#include "tests.h"
#include "sane_ctype.h"
Include dependency graph for code-reading.c:

Go to the source code of this file.

Classes

struct  state
 

Macros

#define BUFSZ   1024
 
#define READLEN   128
 

Enumerations

enum  {
  TEST_CODE_READING_OK, TEST_CODE_READING_NO_VMLINUX, TEST_CODE_READING_NO_KCORE, TEST_CODE_READING_NO_ACCESS,
  TEST_CODE_READING_NO_KERNEL_OBJ
}
 

Functions

static unsigned int hex (char c)
 
static size_t read_objdump_chunk (const char **line, unsigned char **buf, size_t *buf_len)
 
static size_t read_objdump_line (const char *line, unsigned char *buf, size_t buf_len)
 
static int read_objdump_output (FILE *f, void *buf, size_t *len, u64 start_addr)
 
static int read_via_objdump (const char *filename, u64 addr, void *buf, size_t len)
 
static void dump_buf (unsigned char *buf, size_t len)
 
static int read_object_code (u64 addr, size_t len, u8 cpumode, struct thread *thread, struct state *state)
 
static int process_sample_event (struct machine *machine, struct perf_evlist *evlist, union perf_event *event, struct state *state)
 
static int process_event (struct machine *machine, struct perf_evlist *evlist, union perf_event *event, struct state *state)
 
static int process_events (struct machine *machine, struct perf_evlist *evlist, struct state *state)
 
static int comp (const void *a, const void *b)
 
static void do_sort_something (void)
 
static void sort_something (void)
 
static void syscall_something (void)
 
static void fs_something (void)
 
static const char * do_determine_event (bool excl_kernel)
 
static void do_something (void)
 
static int do_test_code_reading (bool try_kcore)
 
int test__code_reading (struct test *test __maybe_unused, int subtest __maybe_unused)
 

Macro Definition Documentation

◆ BUFSZ

#define BUFSZ   1024

Definition at line 25 of file code-reading.c.

◆ READLEN

#define READLEN   128

Definition at line 26 of file code-reading.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TEST_CODE_READING_OK 
TEST_CODE_READING_NO_VMLINUX 
TEST_CODE_READING_NO_KCORE 
TEST_CODE_READING_NO_ACCESS 
TEST_CODE_READING_NO_KERNEL_OBJ 

Definition at line 527 of file code-reading.c.

Function Documentation

◆ comp()

static int comp ( const void *  a,
const void *  b 
)
static

Definition at line 430 of file code-reading.c.

◆ do_determine_event()

static const char* do_determine_event ( bool  excl_kernel)
static

Definition at line 490 of file code-reading.c.

Here is the call graph for this function:

◆ do_something()

static void do_something ( void  )
static

Definition at line 518 of file code-reading.c.

Here is the call graph for this function:

◆ do_sort_something()

static void do_sort_something ( void  )
static

Definition at line 435 of file code-reading.c.

Here is the call graph for this function:

◆ do_test_code_reading()

static int do_test_code_reading ( bool  try_kcore)
static

Definition at line 535 of file code-reading.c.

Here is the call graph for this function:

◆ dump_buf()

static void dump_buf ( unsigned char *  buf,
size_t  len 
)
static

Definition at line 213 of file code-reading.c.

◆ fs_something()

static void fs_something ( void  )
static

Definition at line 475 of file code-reading.c.

◆ hex()

static unsigned int hex ( char  c)
static

Definition at line 33 of file code-reading.c.

◆ process_event()

static int process_event ( struct machine machine,
struct perf_evlist evlist,
union perf_event event,
struct state state 
)
static

Definition at line 384 of file code-reading.c.

Here is the call graph for this function:

◆ process_events()

static int process_events ( struct machine machine,
struct perf_evlist evlist,
struct state state 
)
static

Definition at line 407 of file code-reading.c.

Here is the call graph for this function:

◆ process_sample_event()

static int process_sample_event ( struct machine machine,
struct perf_evlist evlist,
union perf_event event,
struct state state 
)
static

Definition at line 360 of file code-reading.c.

Here is the call graph for this function:

◆ read_objdump_chunk()

static size_t read_objdump_chunk ( const char **  line,
unsigned char **  buf,
size_t *  buf_len 
)
static

Definition at line 42 of file code-reading.c.

Here is the call graph for this function:

◆ read_objdump_line()

static size_t read_objdump_line ( const char *  line,
unsigned char *  buf,
size_t  buf_len 
)
static

Definition at line 95 of file code-reading.c.

Here is the call graph for this function:

◆ read_objdump_output()

static int read_objdump_output ( FILE *  f,
void *  buf,
size_t *  len,
u64  start_addr 
)
static

Definition at line 124 of file code-reading.c.

Here is the call graph for this function:

◆ read_object_code()

static int read_object_code ( u64  addr,
size_t  len,
u8  cpumode,
struct thread thread,
struct state state 
)
static

Definition at line 225 of file code-reading.c.

Here is the call graph for this function:

◆ read_via_objdump()

static int read_via_objdump ( const char *  filename,
u64  addr,
void *  buf,
size_t  len 
)
static

Definition at line 176 of file code-reading.c.

Here is the call graph for this function:

◆ sort_something()

static void sort_something ( void  )
static

Definition at line 452 of file code-reading.c.

Here is the call graph for this function:

◆ syscall_something()

static void syscall_something ( void  )
static

Definition at line 460 of file code-reading.c.

◆ test__code_reading()

int test__code_reading ( struct test *test  __maybe_unused,
int subtest  __maybe_unused 
)

Definition at line 713 of file code-reading.c.

Here is the call graph for this function: