GDBserver

Classes | Macros | Functions | Variables
lynx-low.c File Reference
`#include "server.h"`
`#include "target.h"`
`#include "lynx-low.h"`
`#include <limits.h>`
`#include <sys/ptrace.h>`
`#include <sys/piddef.h>`
`#include <unistd.h>`
`#include <sys/ioctl.h>`
`#include <sys/types.h>`
`#include "gdb_wait.h"`
`#include <signal.h>`
`#include "filestuff.h"`
`#include "common-inferior.h"`
`#include "nat/fork-inferior.h"`

Go to the source code of this file.

## Classes
struct | process_info_private

## Macros
#define | CASE(X) case X: return #X

## Functions
static void | lynx_debug (char *string,...)
static ptid_t | lynx_ptid_build (int pid, long tid)
static int | lynx_ptid_get_pid (ptid_t ptid)
static long | lynx_ptid_get_tid (ptid_t ptid)
static int | lynx_ptrace_pid_from_ptid (ptid_t ptid)
static char * | ptrace_request_to_str (int request)
static int | lynx_ptrace (int request, ptid_t ptid, int addr, int data, int addr2)
static struct process_info * | lynx_add_process (int pid, int attached)
static void | lynx_ptrace_fun ()
static int | lynx_create_inferior (const char *program, const std::vector< char *> &program_args)
static void | lynx_add_threads_after_attach (int pid)
static int | lynx_attach (unsigned long pid)
static void | lynx_resume (struct thread_resume *resume_info, size_t n)
static void | lynx_continue (ptid_t ptid)
static int | lynx_waitpid (int pid, int *stat_loc)
static ptid_t | lynx_wait_1 (ptid_t ptid, struct target_waitstatus *status, int options)
static ptid_t | lynx_wait (ptid_t ptid, struct target_waitstatus *status, int options)
static int | lynx_kill (int pid)
static int | lynx_detach (int pid)
static void | lynx_mourn (struct process_info *proc)
static void | lynx_join (int pid)
static int | lynx_thread_alive (ptid_t ptid)
static void | lynx_fetch_registers (struct regcache *regcache, int regno)
static void | lynx_store_registers (struct regcache *regcache, int regno)
static int | lynx_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
static int | lynx_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
static void | lynx_request_interrupt (void)
void | initialize_low (void)

## Variables
int | using_threads = 1
const struct target_desc * | lynx_tdesc
static struct target_ops | lynx_target_ops

## Macro Definition Documentation

## ◆ CASE

#define CASE | ( |  | X | ) | case X: return #X

Referenced by ptrace_request_to_str().

## Function Documentation

## ◆ initialize_low()

void initialize_low | ( | void |  | ) |

Definition at line 782 of file lynx-low.c.

References linux_target_ops::arch_setup, set_target_ops(), and the_low_target.

## ◆ lynx_add_process()

static struct process_info* lynx_add_process | ( | int | pid,
|  | int | attached
| ) |  |
| static

Definition at line 217 of file lynx-low.c.

References add_process(), process_info::attached, process_info_private::last_wait_event_ptid, lynx_tdesc, null_ptid, process_info::pid, process_info::priv, process_info::tdesc, and XCNEW.

Referenced by lynx_attach(), and lynx_create_inferior().

## ◆ lynx_add_threads_after_attach()

static void lynx_add_threads_after_attach | ( | int | pid | ) |
| static

Definition at line 278 of file lynx-low.c.

References add_thread(), find_thread_ptid(), lynx_debug(), lynx_ptid_build(), perror_with_name(), and process_info::pid.

Referenced by lynx_attach().

## ◆ lynx_attach()

static int lynx_attach | ( | unsigned long | pid | ) |
| static

Definition at line 313 of file lynx-low.c.

References errno, error(), lynx_add_process(), lynx_add_threads_after_attach(), lynx_ptid_build(), lynx_ptrace(), process_info::pid, and strerror().

## ◆ lynx_continue()

static void lynx_continue | ( | ptid_t | ptid | ) |
| static

Definition at line 366 of file lynx-low.c.

References thread_resume::kind, lynx_resume(), thread_resume::sig, and thread_resume::thread.

Referenced by lynx_wait_1().

## ◆ lynx_create_inferior()

static int lynx_create_inferior | ( | const char * | program,
|  | const std::vector< char *> & | program_args
| ) |  |
| static

Definition at line 252 of file lynx-low.c.

References gdb_environ::envp(), fork_inferior(), get_environ(), lynx_add_process(), lynx_debug(), lynx_ptrace_fun(), process_info::pid, post_fork_inferior(), program_args, string, and stringify_argv().

## ◆ lynx_debug()

static void lynx_debug | ( | char * | string,
|  |  | ...
| ) |  |
| static

Definition at line 50 of file lynx-low.c.

References debug_threads.

Referenced by lynx_add_threads_after_attach(), lynx_create_inferior(), lynx_fetch_registers(), lynx_store_registers(), lynx_wait(), and lynx_wait_1().

## ◆ lynx_detach()

static int lynx_detach | ( | int | pid | ) |
| static

Definition at line 544 of file lynx-low.c.

References find_process_pid(), lynx_ptid_build(), lynx_ptrace(), target_ops::mourn, process_info::pid, and the_target.

## ◆ lynx_fetch_registers()

static void lynx_fetch_registers | ( | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 594 of file lynx-low.c.

References current_thread, free(), lynx_regset_info::get_request, lynx_debug(), lynx_ptrace(), lynx_target_regsets, perror(), ptid_of(), lynx_regset_info::size, lynx_regset_info::store_function, and xmalloc().

## ◆ lynx_join()

static void lynx_join | ( | int | pid | ) |
| static

Definition at line 575 of file lynx-low.c.

## ◆ lynx_kill()

static int lynx_kill | ( | int | pid | ) |
| static

Definition at line 525 of file lynx-low.c.

References find_process_pid(), lynx_ptid_build(), lynx_ptrace(), lynx_wait(), target_ops::mourn, process_info::pid, and the_target.

## ◆ lynx_mourn()

static void lynx_mourn | ( | struct process_info * | proc | ) |
| static

Definition at line 561 of file lynx-low.c.

References for_each_thread(), free(), process_info::pid, process_info::priv, remove_process(), and remove_thread().

## ◆ lynx_ptid_build()

static ptid_t lynx_ptid_build | ( | int | pid,
|  | long | tid
| ) |  |
| static

Definition at line 67 of file lynx-low.c.

References ptid_build().

Referenced by lynx_add_threads_after_attach(), lynx_attach(), lynx_detach(), lynx_kill(), and lynx_wait_1().

## ◆ lynx_ptid_get_pid()

static int lynx_ptid_get_pid | ( | ptid_t | ptid | ) |
| static

Definition at line 84 of file lynx-low.c.

References ptid_get_pid().

Referenced by lynx_ptrace_pid_from_ptid(), lynx_request_interrupt(), lynx_wait(), and lynx_wait_1().

## ◆ lynx_ptid_get_tid()

static long lynx_ptid_get_tid | ( | ptid_t | ptid | ) |
| static

Definition at line 92 of file lynx-low.c.

References ptid_get_lwp().

Referenced by lynx_ptrace_pid_from_ptid(), lynx_wait(), and lynx_wait_1().

## ◆ lynx_ptrace()

static int lynx_ptrace | ( | int | request,
|  | ptid_t | ptid,
|  | int | addr,
|  | int | data,
|  | int | addr2
| ) |  |
| static

Definition at line 193 of file lynx-low.c.

References debug_threads, errno, lynx_ptrace_pid_from_ptid(), ptrace(), and ptrace_request_to_str().

Referenced by lynx_attach(), lynx_detach(), lynx_fetch_registers(), lynx_kill(), lynx_ptrace_fun(), lynx_read_memory(), lynx_resume(), lynx_store_registers(), lynx_wait_1(), and lynx_write_memory().

## ◆ lynx_ptrace_fun()

static void lynx_ptrace_fun | ( |  | ) |
| static

Definition at line 232 of file lynx-low.c.

References lynx_ptrace(), null_ptid, and trace_start_error_with_name().

Referenced by lynx_create_inferior().

## ◆ lynx_ptrace_pid_from_ptid()

static int lynx_ptrace_pid_from_ptid | ( | ptid_t | ptid | ) |
| static

Definition at line 103 of file lynx-low.c.

References lynx_ptid_get_pid(), and lynx_ptid_get_tid().

Referenced by lynx_ptrace().

## ◆ lynx_read_memory()

static int lynx_read_memory | ( | CORE_ADDR | memaddr,
|  | unsigned char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 651 of file lynx-low.c.

References current_thread, errno, lynx_ptrace(), and ptid_of().

Referenced by lynx_write_memory().

## ◆ lynx_request_interrupt()

static void lynx_request_interrupt | ( | void |  | ) |
| static

Definition at line 725 of file lynx-low.c.

References get_first_thread(), lynx_ptid_get_pid(), and ptid_of().

## ◆ lynx_resume()

static void lynx_resume | ( | struct thread_resume * | resume_info,
|  | size_t | n
| ) |  |
| static

Definition at line 330 of file lynx-low.c.

References current_process(), current_thread, errno, thread_resume::kind, process_info_private::last_wait_event_ptid, lynx_ptrace(), minus_one_ptid, perror_with_name(), process_info::priv, ptid_equal(), ptid_get_pid(), ptid_of(), regcache_invalidate_pid(), thread_resume::sig, and thread_resume::thread.

Referenced by lynx_continue().

## ◆ lynx_store_registers()

static void lynx_store_registers | ( | struct regcache * | regcache,
|  | int | regno
| ) |  |
| static

Definition at line 619 of file lynx-low.c.

References current_thread, lynx_regset_info::fill_function, free(), lynx_regset_info::get_request, lynx_debug(), lynx_ptrace(), lynx_target_regsets, perror(), ptid_of(), lynx_regset_info::set_request, lynx_regset_info::size, and xmalloc().

## ◆ lynx_thread_alive()

static int lynx_thread_alive | ( | ptid_t | ptid | ) |
| static

Definition at line 584 of file lynx-low.c.

References find_thread_ptid().

## ◆ lynx_wait()

static ptid_t lynx_wait | ( | ptid_t | ptid,
|  | struct target_waitstatus * | status,
|  | int | options
| ) |  |
| static

Definition at line 509 of file lynx-low.c.

References lynx_debug(), lynx_ptid_get_pid(), lynx_ptid_get_tid(), and lynx_wait_1().

Referenced by lynx_kill().

## ◆ lynx_wait_1()

static ptid_t lynx_wait_1 | ( | ptid_t | ptid,
|  | struct target_waitstatus * | status,
|  | int | options
| ) |  |
| static

Definition at line 418 of file lynx-low.c.

References add_thread(), current_thread, find_process_pid(), find_thread_ptid(), gdb_signal_from_host(), process_info_private::last_wait_event_ptid, lynx_continue(), lynx_debug(), lynx_ptid_build(), lynx_ptid_get_pid(), lynx_ptid_get_tid(), lynx_ptrace(), lynx_waitpid(), minus_one_ptid, process_info::priv, ptid_equal(), ptid_of(), remove_thread(), WEXITSTATUS, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WSTOPSIG, and WTERMSIG.

Referenced by lynx_wait().

## ◆ lynx_waitpid()

static int lynx_waitpid | ( | int | pid,
|  | int * | stat_loc
| ) |  |
| static

Definition at line 381 of file lynx-low.c.

References errno, perror_with_name(), WNOHANG, and WUNTRACED.

Referenced by lynx_wait_1().

## ◆ lynx_write_memory()

static int lynx_write_memory | ( | CORE_ADDR | memaddr,
|  | const unsigned char * | myaddr,
|  | int | len
| ) |  |
| static

Definition at line 684 of file lynx-low.c.

References current_thread, errno, lynx_ptrace(), lynx_read_memory(), and ptid_of().

## ◆ ptrace_request_to_str()

static char* ptrace_request_to_str | ( | int | request | ) |
| static

Definition at line 111 of file lynx-low.c.

References CASE.

Referenced by lynx_ptrace().

## Variable Documentation

## ◆ lynx_target_ops

struct target_ops lynx_target_ops
| static

Definition at line 734 of file lynx-low.c.

## ◆ lynx_tdesc

const struct target_desc* lynx_tdesc

Definition at line 36 of file lynx-low.c.

Referenced by lynx_add_process(), lynx_i386_arch_setup(), and lynx_ppc_arch_setup().

## ◆ using_threads

int using_threads = 1

Definition at line 34 of file lynx-low.c.