xref: /netbsd-src/external/gpl3/gdb.old/dist/gdbsupport/agent.h (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
17d62b00eSchristos /* Shared utility routines for GDB to interact with agent.
27d62b00eSchristos 
3*6881a400Schristos    Copyright (C) 2009-2023 Free Software Foundation, Inc.
47d62b00eSchristos 
57d62b00eSchristos    This file is part of GDB.
67d62b00eSchristos 
77d62b00eSchristos    This program is free software; you can redistribute it and/or modify
87d62b00eSchristos    it under the terms of the GNU General Public License as published by
97d62b00eSchristos    the Free Software Foundation; either version 3 of the License, or
107d62b00eSchristos    (at your option) any later version.
117d62b00eSchristos 
127d62b00eSchristos    This program is distributed in the hope that it will be useful,
137d62b00eSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
147d62b00eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
157d62b00eSchristos    GNU General Public License for more details.
167d62b00eSchristos 
177d62b00eSchristos    You should have received a copy of the GNU General Public License
187d62b00eSchristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
197d62b00eSchristos 
207d62b00eSchristos #ifndef COMMON_AGENT_H
217d62b00eSchristos #define COMMON_AGENT_H
227d62b00eSchristos 
237d62b00eSchristos #include "gdbsupport/preprocessor.h"
247d62b00eSchristos 
257d62b00eSchristos int agent_run_command (int pid, const char *cmd, int len);
267d62b00eSchristos 
277d62b00eSchristos int agent_look_up_symbols (void *);
287d62b00eSchristos 
297d62b00eSchristos #define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_ ## SYM
307d62b00eSchristos 
317d62b00eSchristos /* Define an entry in an IPA symbol list array.  If IPA_SYM is used, the macro
327d62b00eSchristos    IPA_SYM_STRUCT_NAME must be defined to the structure name holding the IPA
337d62b00eSchristos    symbol addresses in that particular file, before including
347d62b00eSchristos    gdbsupport/agent.h.  */
357d62b00eSchristos #define IPA_SYM(SYM)                                   \
367d62b00eSchristos   {                                                    \
377d62b00eSchristos     STRINGIFY (IPA_SYM_EXPORTED_NAME (SYM)),           \
387d62b00eSchristos     offsetof (IPA_SYM_STRUCT_NAME, addr_ ## SYM)       \
397d62b00eSchristos   }
407d62b00eSchristos 
417d62b00eSchristos /* The size in bytes of the buffer used to talk to the IPA helper
427d62b00eSchristos    thread.  */
437d62b00eSchristos #define IPA_CMD_BUF_SIZE 1024
447d62b00eSchristos 
457d62b00eSchristos bool agent_loaded_p (void);
467d62b00eSchristos 
477d62b00eSchristos extern bool debug_agent;
487d62b00eSchristos 
497d62b00eSchristos extern bool use_agent;
507d62b00eSchristos 
517d62b00eSchristos /* Capability of agent.  Different agents may have different capabilities,
527d62b00eSchristos    such as installing fast tracepoint or evaluating breakpoint conditions.
537d62b00eSchristos    Capabilities are represented by bit-maps, and each capability occupies one
547d62b00eSchristos    bit.  */
557d62b00eSchristos 
567d62b00eSchristos enum agent_capa
577d62b00eSchristos {
587d62b00eSchristos   /* Capability to install fast tracepoint.  */
597d62b00eSchristos   AGENT_CAPA_FAST_TRACE = 0x1,
607d62b00eSchristos   /* Capability to install static tracepoint.  */
617d62b00eSchristos   AGENT_CAPA_STATIC_TRACE = (0x1 << 1),
627d62b00eSchristos };
637d62b00eSchristos 
647d62b00eSchristos bool agent_capability_check (enum agent_capa);
657d62b00eSchristos 
667d62b00eSchristos void agent_capability_invalidate (void);
677d62b00eSchristos 
687d62b00eSchristos #endif /* COMMON_AGENT_H */
69