xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/agent.h (revision 5ba1f45f2a09259cc846f20c7c5501604d633c90)
18dffb485Schristos /* Shared utility routines for GDB to interact with agent.
28dffb485Schristos 
3*5ba1f45fSchristos    Copyright (C) 2009-2024 Free Software Foundation, Inc.
48dffb485Schristos 
58dffb485Schristos    This file is part of GDB.
68dffb485Schristos 
78dffb485Schristos    This program is free software; you can redistribute it and/or modify
88dffb485Schristos    it under the terms of the GNU General Public License as published by
98dffb485Schristos    the Free Software Foundation; either version 3 of the License, or
108dffb485Schristos    (at your option) any later version.
118dffb485Schristos 
128dffb485Schristos    This program is distributed in the hope that it will be useful,
138dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
148dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
158dffb485Schristos    GNU General Public License for more details.
168dffb485Schristos 
178dffb485Schristos    You should have received a copy of the GNU General Public License
188dffb485Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
198dffb485Schristos 
208dffb485Schristos #ifndef COMMON_AGENT_H
218dffb485Schristos #define COMMON_AGENT_H
228dffb485Schristos 
238dffb485Schristos #include "gdbsupport/preprocessor.h"
248dffb485Schristos 
25*5ba1f45fSchristos int agent_run_command (int pid, char *cmd, int len);
268dffb485Schristos 
278dffb485Schristos int agent_look_up_symbols (void *);
288dffb485Schristos 
298dffb485Schristos #define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_ ## SYM
308dffb485Schristos 
318dffb485Schristos /* Define an entry in an IPA symbol list array.  If IPA_SYM is used, the macro
328dffb485Schristos    IPA_SYM_STRUCT_NAME must be defined to the structure name holding the IPA
338dffb485Schristos    symbol addresses in that particular file, before including
348dffb485Schristos    gdbsupport/agent.h.  */
358dffb485Schristos #define IPA_SYM(SYM)                                   \
368dffb485Schristos   {                                                    \
378dffb485Schristos     STRINGIFY (IPA_SYM_EXPORTED_NAME (SYM)),           \
388dffb485Schristos     offsetof (IPA_SYM_STRUCT_NAME, addr_ ## SYM)       \
398dffb485Schristos   }
408dffb485Schristos 
418dffb485Schristos /* The size in bytes of the buffer used to talk to the IPA helper
428dffb485Schristos    thread.  */
438dffb485Schristos #define IPA_CMD_BUF_SIZE 1024
448dffb485Schristos 
458dffb485Schristos bool agent_loaded_p (void);
468dffb485Schristos 
478dffb485Schristos extern bool debug_agent;
488dffb485Schristos 
498dffb485Schristos extern bool use_agent;
508dffb485Schristos 
518dffb485Schristos /* Capability of agent.  Different agents may have different capabilities,
528dffb485Schristos    such as installing fast tracepoint or evaluating breakpoint conditions.
538dffb485Schristos    Capabilities are represented by bit-maps, and each capability occupies one
548dffb485Schristos    bit.  */
558dffb485Schristos 
568dffb485Schristos enum agent_capa
578dffb485Schristos {
588dffb485Schristos   /* Capability to install fast tracepoint.  */
598dffb485Schristos   AGENT_CAPA_FAST_TRACE = 0x1,
608dffb485Schristos   /* Capability to install static tracepoint.  */
618dffb485Schristos   AGENT_CAPA_STATIC_TRACE = (0x1 << 1),
628dffb485Schristos };
638dffb485Schristos 
648dffb485Schristos bool agent_capability_check (enum agent_capa);
658dffb485Schristos 
668dffb485Schristos void agent_capability_invalidate (void);
678dffb485Schristos 
688dffb485Schristos #endif /* COMMON_AGENT_H */
69