ide-debugger.h 27.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
/* ide-debugger.h
 *
 * Copyright (C) 2017 Christian Hergert <chergert@redhat.com>
 *
 * 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 3 of the License, or
 * (at your option) any later version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <gio/gio.h>

#include "ide-object.h"

#include "debugger/ide-debugger-breakpoint.h"
#include "debugger/ide-debugger-frame.h"
#include "debugger/ide-debugger-instruction.h"
#include "debugger/ide-debugger-library.h"
#include "debugger/ide-debugger-register.h"
#include "debugger/ide-debugger-thread-group.h"
#include "debugger/ide-debugger-thread.h"
#include "debugger/ide-debugger-types.h"
#include "debugger/ide-debugger-variable.h"
#include "runner/ide-runner.h"

G_BEGIN_DECLS

#define IDE_TYPE_DEBUGGER (ide_debugger_get_type())

G_DECLARE_DERIVABLE_TYPE (IdeDebugger, ide_debugger, IDE, DEBUGGER, IdeObject)

struct _IdeDebuggerClass
{
  IdeObjectClass parent_class;

  /* Signals */

  void       (*log)                      (IdeDebugger                  *self,
                                          IdeDebuggerStream             stream,
                                          GBytes                       *content);
  void       (*thread_group_added)       (IdeDebugger                  *self,
                                          IdeDebuggerThreadGroup       *thread_group);
  void       (*thread_group_removed)     (IdeDebugger                  *self,
                                          IdeDebuggerThreadGroup       *thread_group);
  void       (*thread_group_started)     (IdeDebugger                  *self,
                                          IdeDebuggerThreadGroup       *thread_group);
  void       (*thread_group_exited)      (IdeDebugger                  *self,
                                          IdeDebuggerThreadGroup       *thread_group);
  void       (*thread_added)             (IdeDebugger                  *self,
                                          IdeDebuggerThread            *thread);
  void       (*thread_removed)           (IdeDebugger                  *self,
                                          IdeDebuggerThread            *thread);
  void       (*thread_selected)          (IdeDebugger                  *self,
                                          IdeDebuggerThread            *thread);
  void       (*breakpoint_added)         (IdeDebugger                  *self,
                                          IdeDebuggerBreakpoint        *breakpoint);
  void       (*breakpoint_removed)       (IdeDebugger                  *self,
                                          IdeDebuggerBreakpoint        *breakpoint);
  void       (*breakpoint_modified)      (IdeDebugger                  *self,
                                          IdeDebuggerBreakpoint        *breakpoint);
  void       (*running)                  (IdeDebugger                  *self);
  void       (*stopped)                  (IdeDebugger                  *self,
                                          IdeDebuggerStopReason         stop_reason,
                                          IdeDebuggerBreakpoint        *breakpoint);
  void       (*library_loaded)           (IdeDebugger                  *self,
                                          IdeDebuggerLibrary           *library);
  void       (*library_unloaded)         (IdeDebugger                  *self,
                                          IdeDebuggerLibrary           *library);

  /* Virtual Functions */

  gboolean   (*supports_runner)          (IdeDebugger                  *self,
                                          IdeRunner                    *runner,
                                          gint                         *priority);
  void       (*prepare)                  (IdeDebugger                  *self,
                                          IdeRunner                    *runner);
  gboolean   (*get_can_move)             (IdeDebugger                  *self,
                                          IdeDebuggerMovement           movement);
  void       (*move_async)               (IdeDebugger                  *self,
                                          IdeDebuggerMovement           movement,
                                          GCancellable                 *cancellable,
                                          GAsyncReadyCallback           callback,
                                          gpointer                      user_data);
  gboolean   (*move_finish)              (IdeDebugger                  *self,
                                          GAsyncResult                 *result,
                                          GError                      **error);
  void       (*list_breakpoints_async)   (IdeDebugger                  *self,
                                          GCancellable                 *cancellable,
                                          GAsyncReadyCallback           callback,
                                          gpointer                      user_data);
  GPtrArray *(*list_breakpoints_finish)  (IdeDebugger                  *self,
                                          GAsyncResult                 *result,
                                          GError                      **error);
  void       (*insert_breakpoint_async)  (IdeDebugger                  *self,
                                          IdeDebuggerBreakpoint        *breakpoint,
                                          GCancellable                 *cancellable,
                                          GAsyncReadyCallback           callback,
                                          gpointer                      user_data);
  gboolean   (*insert_breakpoint_finish) (IdeDebugger                  *self,
                                          GAsyncResult                 *result,
                                          GError                      **error);
  void       (*remove_breakpoint_async)  (IdeDebugger                  *self,
                                          IdeDebuggerBreakpoint        *breakpoint,
                                          GCancellable                 *cancellable,
                                          GAsyncReadyCallback           callback,
                                          gpointer                      user_data);
  gboolean   (*remove_breakpoint_finish) (IdeDebugger                  *self,
                                          GAsyncResult                 *result,
                                          GError                      **error);
  void       (*modify_breakpoint_async)  (IdeDebugger                  *self,
                                          IdeDebuggerBreakpointChange   change,
                                          IdeDebuggerBreakpoint        *breakpoint,
                                          GCancellable                 *cancellable,
                                          GAsyncReadyCallback           callback,
                                          gpointer                      user_data);
  gboolean   (*modify_breakpoint_finish) (IdeDebugger                  *self,
                                          GAsyncResult                 *result,
                                          GError                        **error);
  void       (*list_frames_async)        (IdeDebugger                    *self,
                                          IdeDebuggerThread              *thread,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  GPtrArray *(*list_frames_finish)       (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*interrupt_async)          (IdeDebugger                    *self,
                                          IdeDebuggerThreadGroup         *thread_group,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  gboolean   (*interrupt_finish)         (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*send_signal_async)        (IdeDebugger                    *self,
                                          gint                            signum,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  gboolean   (*send_signal_finish)       (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*list_locals_async)        (IdeDebugger                    *self,
                                          IdeDebuggerThread              *thread,
                                          IdeDebuggerFrame               *frame,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  GPtrArray *(*list_locals_finish)       (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*list_params_async)        (IdeDebugger                    *self,
                                          IdeDebuggerThread              *thread,
                                          IdeDebuggerFrame               *frame,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  GPtrArray *(*list_params_finish)       (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*list_registers_async)     (IdeDebugger                    *self,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  GPtrArray *(*list_registers_finish)    (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);
  void       (*disassemble_async)        (IdeDebugger                    *self,
                                          const IdeDebuggerAddressRange  *range,
                                          GCancellable                   *cancellable,
                                          GAsyncReadyCallback             callback,
                                          gpointer                        user_data);
  GPtrArray *(*disassemble_finish)       (IdeDebugger                    *self,
                                          GAsyncResult                   *result,
                                          GError                        **error);

187
  /*< private >*/
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368
  gpointer _reserved1;
  gpointer _reserved2;
  gpointer _reserved3;
  gpointer _reserved4;
  gpointer _reserved5;
  gpointer _reserved6;
  gpointer _reserved7;
  gpointer _reserved8;
  gpointer _reserved9;
  gpointer _reserved10;
  gpointer _reserved11;
  gpointer _reserved12;
  gpointer _reserved13;
  gpointer _reserved14;
  gpointer _reserved15;
  gpointer _reserved16;
  gpointer _reserved17;
  gpointer _reserved18;
  gpointer _reserved19;
  gpointer _reserved20;
  gpointer _reserved21;
  gpointer _reserved22;
  gpointer _reserved23;
  gpointer _reserved24;
  gpointer _reserved25;
  gpointer _reserved26;
  gpointer _reserved27;
  gpointer _reserved28;
  gpointer _reserved29;
  gpointer _reserved30;
  gpointer _reserved31;
  gpointer _reserved32;
};

gboolean           ide_debugger_supports_runner           (IdeDebugger                    *self,
                                                           IdeRunner                      *runner,
                                                           gint                           *priority);
void               ide_debugger_prepare                   (IdeDebugger                    *self,
                                                           IdeRunner                      *runner);
GListModel        *ide_debugger_get_breakpoints           (IdeDebugger                    *self);
const gchar       *ide_debugger_get_display_name          (IdeDebugger                    *self);
void               ide_debugger_set_display_name          (IdeDebugger                    *self,
                                                           const gchar                    *display_name);
gboolean           ide_debugger_get_is_running            (IdeDebugger                    *self);
gboolean           ide_debugger_get_can_move              (IdeDebugger                    *self,
                                                           IdeDebuggerMovement             movement);
GListModel        *ide_debugger_get_threads               (IdeDebugger                    *self);
GListModel        *ide_debugger_get_thread_groups         (IdeDebugger                    *self);
IdeDebuggerThread *ide_debugger_get_selected_thread       (IdeDebugger                    *self);
void               ide_debugger_disassemble_async         (IdeDebugger                    *self,
                                                           const IdeDebuggerAddressRange  *range,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_disassemble_finish        (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_insert_breakpoint_async   (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpoint          *breakpoint,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_insert_breakpoint_finish  (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_interrupt_async           (IdeDebugger                    *self,
                                                           IdeDebuggerThreadGroup         *thread_group,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_interrupt_finish          (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_modify_breakpoint_async   (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpointChange     change,
                                                           IdeDebuggerBreakpoint          *breakpoint,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_modify_breakpoint_finish  (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_remove_breakpoint_async   (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpoint          *breakpoint,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_remove_breakpoint_finish  (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_list_breakpoints_async    (IdeDebugger                    *self,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_list_breakpoints_finish   (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_list_frames_async         (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_list_frames_finish        (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_list_locals_async         (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread,
                                                           IdeDebuggerFrame               *frame,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_list_locals_finish        (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_list_params_async         (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread,
                                                           IdeDebuggerFrame               *frame,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_list_params_finish        (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_list_registers_async      (IdeDebugger                    *self,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
GPtrArray         *ide_debugger_list_registers_finish     (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_move_async                (IdeDebugger                    *self,
                                                           IdeDebuggerMovement             movement,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_move_finish               (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
void               ide_debugger_send_signal_async         (IdeDebugger                    *self,
                                                           gint                            signum,
                                                           GCancellable                   *cancellable,
                                                           GAsyncReadyCallback             callback,
                                                           gpointer                        user_data);
gboolean           ide_debugger_send_signal_finish        (IdeDebugger                    *self,
                                                           GAsyncResult                   *result,
                                                           GError                        **error);
const gchar       *ide_debugger_locate_binary_at_address  (IdeDebugger                    *self,
                                                           IdeDebuggerAddress              address);
void               ide_debugger_emit_log                  (IdeDebugger                    *self,
                                                           IdeDebuggerStream               stream,
                                                           GBytes                         *content);
void               ide_debugger_emit_thread_group_added   (IdeDebugger                    *self,
                                                           IdeDebuggerThreadGroup         *thread_group);
void               ide_debugger_emit_thread_group_removed (IdeDebugger                    *self,
                                                           IdeDebuggerThreadGroup         *thread_group);
void               ide_debugger_emit_thread_group_started (IdeDebugger                    *self,
                                                           IdeDebuggerThreadGroup         *thread_group);
void               ide_debugger_emit_thread_group_exited  (IdeDebugger                    *self,
                                                           IdeDebuggerThreadGroup         *thread_group);
void               ide_debugger_emit_thread_added         (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread);
void               ide_debugger_emit_thread_removed       (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread);
void               ide_debugger_emit_thread_selected      (IdeDebugger                    *self,
                                                           IdeDebuggerThread              *thread);
void               ide_debugger_emit_breakpoint_added     (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpoint          *breakpoint);
void               ide_debugger_emit_breakpoint_modified  (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpoint          *breakpoint);
void               ide_debugger_emit_breakpoint_removed   (IdeDebugger                    *self,
                                                           IdeDebuggerBreakpoint          *breakpoint);
void               ide_debugger_emit_running              (IdeDebugger                    *self);
void               ide_debugger_emit_stopped              (IdeDebugger                    *self,
                                                           IdeDebuggerStopReason           stop_reason,
                                                           IdeDebuggerBreakpoint          *breakpoint);
void               ide_debugger_emit_library_loaded       (IdeDebugger                    *self,
                                                           IdeDebuggerLibrary             *library);
void               ide_debugger_emit_library_unloaded     (IdeDebugger                    *self,
                                                           IdeDebuggerLibrary             *library);

G_END_DECLS