1999-04-16 03:35:26 +02:00
|
|
|
/* Multi-process/thread control defs for GDB, the GNU debugger.
|
2001-03-06 09:22:02 +01:00
|
|
|
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1997, 1998, 1999,
|
|
|
|
2000
|
1999-04-16 03:35:26 +02:00
|
|
|
Free Software Foundation, Inc.
|
2001-03-06 09:22:02 +01:00
|
|
|
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#ifndef GDBTHREAD_H
|
|
|
|
#define GDBTHREAD_H
|
|
|
|
|
2003-04-12 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh: Add missing opaque declarations.
* gdbarch.h: Regnerate.
* symtab.h: Add missing opaque declarations.
* value.h, target.h, symfile.h, stabsread.h: Ditto.
* x86-64-tdep.h, xmodem.h, monitor.h, typeprint.h: Ditto.
* srec.h, solib-svr4.h, source.h, inferior.h: Ditto.
* ser-unix.h, serial.h, remote-utils.h, gdbcore.h: Ditto.
* ppc-tdep.h, ocd.h, mips-tdep.h, gdbtypes.h: Ditto.
* buildsym.h, builtin-regs.h, linespec.h, language.h: Ditto.
* i387-tdep.h, gdbthread.h, event-top.h, gdb.h: Ditto.
* dwarf2cfi.h, doublest.h, disasm.h, cp-abi.h: Ditto.
* cli-out.h, c-lang.h, ax-gdb.h, arch-utils.h: Ditto.
* ada-lang.h, config/nm-lynx.h, config/nm-linux.h: Ditto.
* config/sparc/tm-sp64.h, config/rs6000/tm-rs6000.h: Ditto.
* config/pa/tm-hppah.h, config/m68k/tm-delta68.h: Ditto.
* cli/cli-setshow.h, cli/cli-script.h: Ditto.
2003-04-12 19:41:26 +02:00
|
|
|
struct breakpoint;
|
|
|
|
struct frame_id;
|
|
|
|
struct symtab;
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* For bpstat */
|
|
|
|
#include "breakpoint.h"
|
|
|
|
|
2002-12-06 08:35:55 +01:00
|
|
|
/* For struct frame_id. */
|
|
|
|
#include "frame.h"
|
|
|
|
|
2000-01-11 04:07:37 +01:00
|
|
|
struct thread_info
|
|
|
|
{
|
|
|
|
struct thread_info *next;
|
2001-05-04 06:15:33 +02:00
|
|
|
ptid_t ptid; /* "Actual process id";
|
2000-01-11 04:07:37 +01:00
|
|
|
In fact, this may be overloaded with
|
|
|
|
kernel thread id, etc. */
|
|
|
|
int num; /* Convenient handle (GDB thread id) */
|
|
|
|
/* State from wait_for_inferior */
|
|
|
|
CORE_ADDR prev_pc;
|
|
|
|
struct breakpoint *step_resume_breakpoint;
|
|
|
|
CORE_ADDR step_range_start;
|
|
|
|
CORE_ADDR step_range_end;
|
2002-12-06 08:35:55 +01:00
|
|
|
struct frame_id step_frame_id;
|
2001-06-13 Michael Snyder <msnyder@redhat.com>
* gdbthread.h (struct thread_info): Add new fields:
current_line, current_symtab, step_sp, for saved infrun state.
* thread.c (save_infrun_state, load_infrun_state): Save and
restore current_line, current_symtab, and step_sp.
(add_thread): Rather than adding assignments to initialize
the new fields, just use memset (tp, 0, sizeof (*tp).
This way future new fields will not be overlooked.
* infrun.c (handle_inferior_event): Save and restore save_sp,
current_line, and current_symtab when switching threads.
2001-06-14 00:56:16 +02:00
|
|
|
int current_line;
|
|
|
|
struct symtab *current_symtab;
|
2000-01-11 04:07:37 +01:00
|
|
|
int trap_expected;
|
|
|
|
int handling_longjmp;
|
|
|
|
int another_trap;
|
|
|
|
|
|
|
|
/* This is set TRUE when a catchpoint of a shared library event
|
|
|
|
triggers. Since we don't wish to leave the inferior in the
|
|
|
|
solib hook when we report the event, we step the inferior
|
|
|
|
back to user code before stopping and reporting the event. */
|
|
|
|
int stepping_through_solib_after_catch;
|
|
|
|
|
|
|
|
/* When stepping_through_solib_after_catch is TRUE, this is a
|
|
|
|
list of the catchpoints that should be reported as triggering
|
|
|
|
when we finally do stop stepping. */
|
|
|
|
bpstat stepping_through_solib_catchpoints;
|
|
|
|
|
|
|
|
/* Private data used by the target vector implementation. */
|
|
|
|
struct private_thread_info *private;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Create an empty thread list, or empty the existing one. */
|
|
|
|
extern void init_thread_list (void);
|
|
|
|
|
|
|
|
/* Add a thread to the thread list.
|
|
|
|
Note that add_thread now returns the handle of the new thread,
|
|
|
|
so that the caller may initialize the private thread data. */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern struct thread_info *add_thread (ptid_t ptid);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* Delete an existing thread list entry. */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern void delete_thread (ptid_t);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
2001-06-02 02:36:20 +02:00
|
|
|
/* Delete a step_resume_breakpoint from the thread database. */
|
|
|
|
extern void delete_step_resume_breakpoint (void *);
|
|
|
|
|
2000-01-11 04:07:37 +01:00
|
|
|
/* Translate the integer thread id (GDB's homegrown id, not the system's)
|
|
|
|
into a "pid" (which may be overloaded with extra thread information). */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern ptid_t thread_id_to_pid (int);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* Translate a 'pid' (which may be overloaded with extra thread information)
|
|
|
|
into the integer thread id (GDB's homegrown id, not the system's). */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern int pid_to_thread_id (ptid_t ptid);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* Boolean test for an already-known pid (which may be overloaded with
|
|
|
|
extra thread information). */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern int in_thread_list (ptid_t ptid);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* Boolean test for an already-known thread id (GDB's homegrown id,
|
|
|
|
not the system's). */
|
|
|
|
extern int valid_thread_id (int thread);
|
|
|
|
|
|
|
|
/* Search function to lookup a thread by 'pid'. */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern struct thread_info *find_thread_pid (ptid_t ptid);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* Iterator function to call a user-provided callback function
|
|
|
|
once for each known thread. */
|
|
|
|
typedef int (*thread_callback_func) (struct thread_info *, void *);
|
|
|
|
extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
|
|
|
|
|
|
|
|
/* infrun context switch: save the debugger state for the given thread. */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern void save_infrun_state (ptid_t ptid,
|
2000-01-11 04:07:37 +01:00
|
|
|
CORE_ADDR prev_pc,
|
|
|
|
int trap_expected,
|
|
|
|
struct breakpoint *step_resume_breakpoint,
|
|
|
|
CORE_ADDR step_range_start,
|
|
|
|
CORE_ADDR step_range_end,
|
2002-12-06 08:35:55 +01:00
|
|
|
const struct frame_id *step_frame_id,
|
2000-01-11 04:07:37 +01:00
|
|
|
int handling_longjmp,
|
|
|
|
int another_trap,
|
|
|
|
int stepping_through_solib_after_catch,
|
|
|
|
bpstat stepping_through_solib_catchpoints,
|
2001-06-13 Michael Snyder <msnyder@redhat.com>
* gdbthread.h (struct thread_info): Add new fields:
current_line, current_symtab, step_sp, for saved infrun state.
* thread.c (save_infrun_state, load_infrun_state): Save and
restore current_line, current_symtab, and step_sp.
(add_thread): Rather than adding assignments to initialize
the new fields, just use memset (tp, 0, sizeof (*tp).
This way future new fields will not be overlooked.
* infrun.c (handle_inferior_event): Save and restore save_sp,
current_line, and current_symtab when switching threads.
2001-06-14 00:56:16 +02:00
|
|
|
int current_line,
|
2004-05-13 00:19:02 +02:00
|
|
|
struct symtab *current_symtab);
|
2000-01-11 04:07:37 +01:00
|
|
|
|
|
|
|
/* infrun context switch: load the debugger state previously saved
|
|
|
|
for the given thread. */
|
2001-05-04 06:15:33 +02:00
|
|
|
extern void load_infrun_state (ptid_t ptid,
|
2000-01-11 04:07:37 +01:00
|
|
|
CORE_ADDR *prev_pc,
|
|
|
|
int *trap_expected,
|
|
|
|
struct breakpoint **step_resume_breakpoint,
|
|
|
|
CORE_ADDR *step_range_start,
|
|
|
|
CORE_ADDR *step_range_end,
|
2002-12-06 08:35:55 +01:00
|
|
|
struct frame_id *step_frame_id,
|
2000-01-11 04:07:37 +01:00
|
|
|
int *handling_longjmp,
|
|
|
|
int *another_trap,
|
|
|
|
int *stepping_through_solib_affter_catch,
|
|
|
|
bpstat *stepping_through_solib_catchpoints,
|
2001-06-13 Michael Snyder <msnyder@redhat.com>
* gdbthread.h (struct thread_info): Add new fields:
current_line, current_symtab, step_sp, for saved infrun state.
* thread.c (save_infrun_state, load_infrun_state): Save and
restore current_line, current_symtab, and step_sp.
(add_thread): Rather than adding assignments to initialize
the new fields, just use memset (tp, 0, sizeof (*tp).
This way future new fields will not be overlooked.
* infrun.c (handle_inferior_event): Save and restore save_sp,
current_line, and current_symtab when switching threads.
2001-06-14 00:56:16 +02:00
|
|
|
int *current_line,
|
2004-05-13 00:19:02 +02:00
|
|
|
struct symtab **current_symtab);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* Commands with a prefix of `thread'. */
|
|
|
|
extern struct cmd_list_element *thread_cmd_list;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
#endif /* GDBTHREAD_H */
|