GDBserver

Functions | Variables
linux-ptrace.c File Reference
`#include "common-defs.h"`
`#include "linux-ptrace.h"`
`#include "linux-procfs.h"`
`#include "linux-waitpid.h"`
`#include "buffer.h"`
`#include "gdb_wait.h"`
`#include "gdb_ptrace.h"`

Go to the source code of this file.

## Functions
void | linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer)
char * | linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err)
static void | linux_ptrace_test_ret_to_nx (void)
static int | linux_fork_to_function (gdb_byte *child_stack, int(*function)(void *))
static int | linux_grandchild_function (void *child_stack)
static int | linux_child_function (void *child_stack)
static void | linux_test_for_tracesysgood (int child_pid)
static void | linux_test_for_tracefork (int child_pid)
static void | linux_test_for_exitkill (int child_pid)
void | linux_check_ptrace_features (void)
void | linux_enable_event_reporting (pid_t pid, int options)
void | linux_disable_event_reporting (pid_t pid)
static int | ptrace_supports_feature (int ptrace_options)
int | linux_supports_tracefork (void)
int | linux_supports_traceexec (void)
int | linux_supports_traceclone (void)
int | linux_supports_tracevforkdone (void)
int | linux_supports_tracesysgood (void)
void | linux_ptrace_init_warnings (void)
int | linux_ptrace_get_extended_event (int wstat)
int | linux_is_extended_waitstatus (int wstat)
int | linux_wstatus_maybe_breakpoint (int wstat)

## Variables
static int | supported_ptrace_options = -1

## Function Documentation

## ◆ linux_check_ptrace_features()

void linux_check_ptrace_features | ( | void |  | ) |

Definition at line 337 of file linux-ptrace.c.

References _, error(), linux_child_function(), linux_fork_to_function(), linux_test_for_exitkill(), linux_test_for_tracefork(), linux_test_for_tracesysgood(), my_waitpid(), perror_with_name(), ptrace(), PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, supported_ptrace_options, warning(), and WIFSTOPPED.

Referenced by initialize_low(), linux_enable_event_reporting(), and ptrace_supports_feature().

## ◆ linux_child_function()

static int linux_child_function | ( | void * | child_stack | ) |
| static

Definition at line 317 of file linux-ptrace.c.

References linux_fork_to_function(), linux_grandchild_function(), ptrace(), PTRACE_TYPE_ARG3, and PTRACE_TYPE_ARG4.

Referenced by linux_check_ptrace_features().

## ◆ linux_disable_event_reporting()

void linux_disable_event_reporting | ( | pid_t | pid | ) |

Definition at line 512 of file linux-ptrace.c.

References ptrace(), PTRACE_SETOPTIONS, and PTRACE_TYPE_ARG3.

## ◆ linux_enable_event_reporting()

void linux_enable_event_reporting | ( | pid_t | pid,
|  | int | options
| ) |  |

Definition at line 491 of file linux-ptrace.c.

References linux_check_ptrace_features(), ptrace(), PTRACE_O_TRACECLONE, PTRACE_SETOPTIONS, PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, and supported_ptrace_options.

Referenced by linux_handle_new_gdb_connection(), linux_low_filter_event(), and linux_post_create_inferior().

## ◆ linux_fork_to_function()

static int linux_fork_to_function | ( | gdb_byte * | child_stack,
|  | int(*)(void *) | function
| ) |  |
| static

Definition at line 264 of file linux-ptrace.c.

References gdb_assert, perror_with_name(), and xmalloc().

Referenced by linux_check_ptrace_features(), and linux_child_function().

## ◆ linux_grandchild_function()

static int linux_grandchild_function | ( | void * | child_stack | ) |
| static

Definition at line 302 of file linux-ptrace.c.

References xfree().

Referenced by linux_child_function().

## ◆ linux_is_extended_waitstatus()

int linux_is_extended_waitstatus | ( | int | wstat | ) |

Definition at line 608 of file linux-ptrace.c.

References linux_ptrace_get_extended_event().

Referenced by get_detach_signal(), and linux_low_filter_event().

## ◆ linux_ptrace_attach_fail_reason()

void linux_ptrace_attach_fail_reason | ( | pid_t | pid,
|  | struct buffer * | buffer
| ) |  |

Definition at line 40 of file linux-ptrace.c.

References _, buffer_xml_printf(), linux_proc_get_tracerpid_nowarn(), and linux_proc_pid_is_zombie_nowarn().

Referenced by linux_ptrace_attach_fail_reason_string().

## ◆ linux_ptrace_attach_fail_reason_string()

char* linux_ptrace_attach_fail_reason_string | ( | ptid_t | ptid,
|  | int | err
| ) |  |

Definition at line 59 of file linux-ptrace.c.

References buffer_finish(), buffer_grow_str0, buffer_init(), linux_ptrace_attach_fail_reason(), ptid_get_lwp(), safe_strerror(), xfree(), and xstrprintf().

Referenced by attach_proc_task_lwp_callback(), attach_thread(), and linux_attach().

## ◆ linux_ptrace_get_extended_event()

int linux_ptrace_get_extended_event | ( | int | wstat | ) |

Definition at line 600 of file linux-ptrace.c.

Referenced by handle_extended_wait(), linux_is_extended_waitstatus(), linux_low_filter_event(), and linux_test_for_tracefork().

## ◆ linux_ptrace_init_warnings()

void linux_ptrace_init_warnings | ( | void |  | ) |

Definition at line 586 of file linux-ptrace.c.

References linux_ptrace_test_ret_to_nx().

Referenced by initialize_low().

## ◆ linux_ptrace_test_ret_to_nx()

static void linux_ptrace_test_ret_to_nx | ( | void |  | ) |
| static

Definition at line 99 of file linux-ptrace.c.

References _, errno, gdb_assert_not_reached, ptrace(), PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, safe_strerror(), warning(), WIFSIGNALED, WIFSTOPPED, WSTOPSIG, and WTERMSIG.

Referenced by linux_ptrace_init_warnings().

## ◆ linux_supports_traceclone()

int linux_supports_traceclone | ( | void |  | ) |

Definition at line 559 of file linux-ptrace.c.

References PTRACE_O_TRACECLONE, and ptrace_supports_feature().

## ◆ linux_supports_traceexec()

int linux_supports_traceexec | ( | void |  | ) |

Definition at line 548 of file linux-ptrace.c.

References PTRACE_O_TRACEEXEC, and ptrace_supports_feature().

Referenced by linux_supports_exec_events().

## ◆ linux_supports_tracefork()

int linux_supports_tracefork | ( | void |  | ) |

Definition at line 537 of file linux-ptrace.c.

References PTRACE_O_TRACEFORK, and ptrace_supports_feature().

Referenced by linux_supports_fork_events(), and linux_supports_vfork_events().

## ◆ linux_supports_tracesysgood()

int linux_supports_tracesysgood | ( | void |  | ) |

Definition at line 577 of file linux-ptrace.c.

References PTRACE_O_TRACESYSGOOD, and ptrace_supports_feature().

Referenced by linux_supports_catch_syscall().

## ◆ linux_supports_tracevforkdone()

int linux_supports_tracevforkdone | ( | void |  | ) |

Definition at line 568 of file linux-ptrace.c.

References PTRACE_O_TRACEVFORKDONE, and ptrace_supports_feature().

## ◆ linux_test_for_exitkill()

static void linux_test_for_exitkill | ( | int | child_pid | ) |
| static

Definition at line 474 of file linux-ptrace.c.

References ptrace(), PTRACE_O_EXITKILL, PTRACE_SETOPTIONS, PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, and supported_ptrace_options.

Referenced by linux_check_ptrace_features().

## ◆ linux_test_for_tracefork()

static void linux_test_for_tracefork | ( | int | child_pid | ) |
| static

Definition at line 397 of file linux-ptrace.c.

References _, linux_ptrace_get_extended_event(), my_waitpid(), ptrace(), PTRACE_EVENT_FORK, PTRACE_GETEVENTMSG, PTRACE_O_TRACECLONE, PTRACE_O_TRACEEXEC, PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK, PTRACE_O_TRACEVFORKDONE, PTRACE_SETOPTIONS, PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, supported_ptrace_options, warning(), and WIFSTOPPED.

Referenced by linux_check_ptrace_features().

## ◆ linux_test_for_tracesysgood()

static void linux_test_for_tracesysgood | ( | int | child_pid | ) |
| static

Definition at line 382 of file linux-ptrace.c.

References ptrace(), PTRACE_O_TRACESYSGOOD, PTRACE_SETOPTIONS, PTRACE_TYPE_ARG3, PTRACE_TYPE_ARG4, and supported_ptrace_options.

Referenced by linux_check_ptrace_features().

## ◆ linux_wstatus_maybe_breakpoint()

int linux_wstatus_maybe_breakpoint | ( | int | wstat | ) |

Definition at line 616 of file linux-ptrace.c.

References WIFSTOPPED, and WSTOPSIG.

Referenced by linux_low_filter_event(), and linux_wait_1().

## ◆ ptrace_supports_feature()

static int ptrace_supports_feature | ( | int | ptrace_options | ) |
| static

Definition at line 523 of file linux-ptrace.c.

References linux_check_ptrace_features(), and supported_ptrace_options.

Referenced by linux_supports_traceclone(), linux_supports_traceexec(), linux_supports_tracefork(), linux_supports_tracesysgood(), and linux_supports_tracevforkdone().

## Variable Documentation

## ◆ supported_ptrace_options

int supported_ptrace_options = -1
| static

Definition at line 33 of file linux-ptrace.c.

Referenced by linux_check_ptrace_features(), linux_enable_event_reporting(), linux_test_for_exitkill(), linux_test_for_tracefork(), linux_test_for_tracesysgood(), and ptrace_supports_feature().