]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/ravenscar-thread.c
Add PR number to previous delta to the bfd/ directory.
[thirdparty/binutils-gdb.git] / gdb / ravenscar-thread.c
CommitLineData
036b1ba8
JB
1/* Ada Ravenscar thread support.
2
e2882c85 3 Copyright (C) 2004-2018 Free Software Foundation, Inc.
036b1ba8
JB
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "gdbcore.h"
22#include "gdbthread.h"
23#include "ada-lang.h"
24#include "target.h"
25#include "inferior.h"
26#include "command.h"
27#include "ravenscar-thread.h"
76727919 28#include "observable.h"
036b1ba8
JB
29#include "gdbcmd.h"
30#include "top.h"
31#include "regcache.h"
77e371c0 32#include "objfiles.h"
036b1ba8 33
9edcc12f
JB
34/* This module provides support for "Ravenscar" tasks (Ada) when
35 debugging on bare-metal targets.
36
37 The typical situation is when debugging a bare-metal target over
38 the remote protocol. In that situation, the system does not know
39 about high-level comcepts such as threads, only about some code
40 running on one or more CPUs. And since the remote protocol does not
41 provide any handling for CPUs, the de facto standard for handling
42 them is to have one thread per CPU, where the thread's ptid has
43 its lwp field set to the CPU number (eg: 1 for the first CPU,
44 2 for the second one, etc). This module will make that assumption.
45
46 This module then creates and maintains the list of threads based
47 on the list of Ada tasks, with one thread per Ada tasks. The convention
48 is that threads corresponding to the CPUs (see assumption above)
49 have a ptid_t of the form (PID, LWP, 0), which threads corresponding
50 to our Ada tasks have a ptid_t of the form (PID, 0, TID) where TID
51 is the Ada task's ID as extracted from Ada runtime information.
52
53 Switching to a given Ada tasks (or its underlying thread) is performed
54 by fetching the registers of that tasks from the memory area where
55 the registers were saved. For any of the other operations, the
56 operation is performed by first finding the CPU on which the task
57 is running, switching to its corresponding ptid, and then performing
58 the operation on that ptid using the target beneath us. */
59
036b1ba8
JB
60/* If non-null, ravenscar task support is enabled. */
61static int ravenscar_task_support = 1;
62
9edcc12f
JB
63/* PTID of the last thread that received an event.
64 This can be useful to determine the associated task that received
65 the event, to make it the current task. */
036b1ba8
JB
66static ptid_t base_ptid;
67
7f39f34a 68static const char running_thread_name[] = "__gnat_running_thread_table";
036b1ba8
JB
69
70static const char known_tasks_name[] = "system__tasking__debug__known_tasks";
6040a59d 71static const char first_task_name[] = "system__tasking__debug__first_task";
036b1ba8 72
0df8b418
MS
73static const char ravenscar_runtime_initializer[] =
74 "system__bb__threads__initialize";
036b1ba8 75
d9f719f1
PA
76static const target_info ravenscar_target_info = {
77 "ravenscar",
78 N_("Ravenscar tasks."),
79 N_("Ravenscar tasks support.")
80};
81
f6ac5f3d
PA
82struct ravenscar_thread_target final : public target_ops
83{
84 ravenscar_thread_target ()
85 { to_stratum = thread_stratum; }
86
d9f719f1
PA
87 const target_info &info () const override
88 { return ravenscar_target_info; }
f6ac5f3d
PA
89
90 ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
91 void resume (ptid_t, int, enum gdb_signal) override;
92
93 void fetch_registers (struct regcache *, int) override;
94 void store_registers (struct regcache *, int) override;
95
96 void prepare_to_store (struct regcache *) override;
97
57810aa7 98 bool stopped_by_sw_breakpoint () override;
f6ac5f3d 99
57810aa7 100 bool stopped_by_hw_breakpoint () override;
f6ac5f3d 101
57810aa7 102 bool stopped_by_watchpoint () override;
f6ac5f3d 103
57810aa7 104 bool stopped_data_address (CORE_ADDR *) override;
f6ac5f3d 105
57810aa7 106 bool thread_alive (ptid_t ptid) override;
f6ac5f3d
PA
107
108 int core_of_thread (ptid_t ptid) override;
109
110 void update_thread_list () override;
111
112 const char *extra_thread_info (struct thread_info *) override;
113
114 const char *pid_to_str (ptid_t) override;
115
116 ptid_t get_ada_task_ptid (long lwp, long thread) override;
117
118 void mourn_inferior () override;
f6ac5f3d
PA
119};
120
121/* This module's target-specific operations. */
122static ravenscar_thread_target ravenscar_ops;
123
9edcc12f 124static ptid_t ravenscar_active_task (int cpu);
036b1ba8
JB
125static void ravenscar_update_inferior_ptid (void);
126static int has_ravenscar_runtime (void);
127static int ravenscar_runtime_initialized (void);
128static void ravenscar_inferior_created (struct target_ops *target,
129 int from_tty);
130
9edcc12f
JB
131/* Return nonzero iff PTID corresponds to a ravenscar task. */
132
133static int
134is_ravenscar_task (ptid_t ptid)
135{
54aa6c67
JB
136 /* By construction, ravenscar tasks have their LWP set to zero.
137 Also make sure that the TID is nonzero, as some remotes, when
138 asked for the list of threads, will return the first thread
139 as having its TID set to zero. For instance, TSIM version
140 2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
141 query, which the remote protocol layer then treats as a thread
142 whose TID is 0. This is obviously not a ravenscar task. */
cc6bcb54 143 return ptid.lwp () == 0 && ptid.tid () != 0;
9edcc12f
JB
144}
145
146/* Given PTID, which can be either a ravenscar task or a CPU thread,
147 return which CPU that ptid is running on.
148
149 This assume that PTID is a valid ptid_t. Otherwise, a gdb_assert
150 will be triggered. */
151
152static int
153ravenscar_get_thread_base_cpu (ptid_t ptid)
154{
155 int base_cpu;
156
157 if (is_ravenscar_task (ptid))
158 {
159 struct ada_task_info *task_info = ada_get_task_info_from_ptid (ptid);
160
161 gdb_assert (task_info != NULL);
162 base_cpu = task_info->base_cpu;
163 }
164 else
165 {
166 /* We assume that the LWP of the PTID is equal to the CPU number. */
e38504b3 167 base_cpu = ptid.lwp ();
9edcc12f
JB
168 }
169
170 return base_cpu;
171}
172
173/* Given a ravenscar task (identified by its ptid_t PTID), return nonzero
174 if this task is the currently active task on the cpu that task is
175 running on.
176
177 In other words, this function determine which CPU this task is
178 currently running on, and then return nonzero if the CPU in question
179 is executing the code for that task. If that's the case, then
180 that task's registers are in the CPU bank. Otherwise, the task
181 is currently suspended, and its registers have been saved in memory. */
182
183static int
184ravenscar_task_is_currently_active (ptid_t ptid)
185{
186 ptid_t active_task_ptid
187 = ravenscar_active_task (ravenscar_get_thread_base_cpu (ptid));
188
d7e15655 189 return ptid == active_task_ptid;
9edcc12f
JB
190}
191
192/* Return the CPU thread (as a ptid_t) on which the given ravenscar
193 task is running.
194
195 This is the thread that corresponds to the CPU on which the task
196 is running. */
197
198static ptid_t
199get_base_thread_from_ravenscar_task (ptid_t ptid)
200{
201 int base_cpu;
202
203 if (!is_ravenscar_task (ptid))
204 return ptid;
205
206 base_cpu = ravenscar_get_thread_base_cpu (ptid);
e99b03dc 207 return ptid_t (ptid.pid (), base_cpu, 0);
9edcc12f
JB
208}
209
036b1ba8
JB
210/* Fetch the ravenscar running thread from target memory and
211 update inferior_ptid accordingly. */
212
213static void
214ravenscar_update_inferior_ptid (void)
215{
9edcc12f
JB
216 int base_cpu;
217
036b1ba8
JB
218 base_ptid = inferior_ptid;
219
9edcc12f
JB
220 gdb_assert (!is_ravenscar_task (inferior_ptid));
221 base_cpu = ravenscar_get_thread_base_cpu (base_ptid);
222
036b1ba8
JB
223 /* If the runtime has not been initialized yet, the inferior_ptid is
224 the only ptid that there is. */
225 if (!ravenscar_runtime_initialized ())
226 return;
227
9edcc12f 228 /* Make sure we set base_ptid before calling ravenscar_active_task
036b1ba8 229 as the latter relies on it. */
9edcc12f 230 inferior_ptid = ravenscar_active_task (base_cpu);
d7e15655 231 gdb_assert (inferior_ptid != null_ptid);
036b1ba8
JB
232
233 /* The running thread may not have been added to
e8032dde 234 system.tasking.debug's list yet; so ravenscar_update_thread_list
036b1ba8
JB
235 may not always add it to the thread list. Add it here. */
236 if (!find_thread_ptid (inferior_ptid))
237 add_thread (inferior_ptid);
238}
239
7f39f34a
JB
240/* The Ravenscar Runtime exports a symbol which contains the ID of
241 the thread that is currently running. Try to locate that symbol
242 and return its associated minimal symbol.
243 Return NULL if not found. */
244
3b7344d5 245static struct bound_minimal_symbol
7f39f34a
JB
246get_running_thread_msymbol (void)
247{
3b7344d5 248 struct bound_minimal_symbol msym;
7f39f34a
JB
249
250 msym = lookup_minimal_symbol (running_thread_name, NULL, NULL);
3b7344d5 251 if (!msym.minsym)
7f39f34a
JB
252 /* Older versions of the GNAT runtime were using a different
253 (less ideal) name for the symbol where the active thread ID
254 is stored. If we couldn't find the symbol using the latest
255 name, then try the old one. */
256 msym = lookup_minimal_symbol ("running_thread", NULL, NULL);
257
258 return msym;
259}
260
036b1ba8
JB
261/* Return True if the Ada Ravenscar run-time can be found in the
262 application. */
263
264static int
265has_ravenscar_runtime (void)
266{
3b7344d5 267 struct bound_minimal_symbol msym_ravenscar_runtime_initializer =
036b1ba8 268 lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL);
3b7344d5 269 struct bound_minimal_symbol msym_known_tasks =
036b1ba8 270 lookup_minimal_symbol (known_tasks_name, NULL, NULL);
3b7344d5 271 struct bound_minimal_symbol msym_first_task =
6040a59d 272 lookup_minimal_symbol (first_task_name, NULL, NULL);
3b7344d5
TT
273 struct bound_minimal_symbol msym_running_thread
274 = get_running_thread_msymbol ();
036b1ba8 275
3b7344d5
TT
276 return (msym_ravenscar_runtime_initializer.minsym
277 && (msym_known_tasks.minsym || msym_first_task.minsym)
278 && msym_running_thread.minsym);
036b1ba8
JB
279}
280
281/* Return True if the Ada Ravenscar run-time can be found in the
282 application, and if it has been initialized on target. */
283
284static int
285ravenscar_runtime_initialized (void)
286{
d7e15655 287 return (!(ravenscar_active_task (1) == null_ptid));
036b1ba8
JB
288}
289
7f39f34a
JB
290/* Return the ID of the thread that is currently running.
291 Return 0 if the ID could not be determined. */
036b1ba8
JB
292
293static CORE_ADDR
9edcc12f 294get_running_thread_id (int cpu)
036b1ba8 295{
3b7344d5 296 struct bound_minimal_symbol object_msym = get_running_thread_msymbol ();
036b1ba8
JB
297 int object_size;
298 int buf_size;
948f8e3d 299 gdb_byte *buf;
036b1ba8
JB
300 CORE_ADDR object_addr;
301 struct type *builtin_type_void_data_ptr =
f5656ead 302 builtin_type (target_gdbarch ())->builtin_data_ptr;
036b1ba8 303
3b7344d5 304 if (!object_msym.minsym)
036b1ba8
JB
305 return 0;
306
036b1ba8 307 object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
9edcc12f
JB
308 object_addr = (BMSYMBOL_VALUE_ADDRESS (object_msym)
309 + (cpu - 1) * object_size);
036b1ba8 310 buf_size = object_size;
224c3ddb 311 buf = (gdb_byte *) alloca (buf_size);
036b1ba8
JB
312 read_memory (object_addr, buf, buf_size);
313 return extract_typed_address (buf, builtin_type_void_data_ptr);
314}
315
f6ac5f3d
PA
316void
317ravenscar_thread_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
036b1ba8 318{
036b1ba8 319 inferior_ptid = base_ptid;
d6ca69cd 320 beneath ()->resume (base_ptid, step, siggnal);
036b1ba8
JB
321}
322
f6ac5f3d
PA
323ptid_t
324ravenscar_thread_target::wait (ptid_t ptid,
325 struct target_waitstatus *status,
326 int options)
036b1ba8 327{
3b1b69bf 328 ptid_t event_ptid;
036b1ba8
JB
329
330 inferior_ptid = base_ptid;
d6ca69cd 331 event_ptid = beneath ()->wait (base_ptid, status, 0);
bed0c243
JB
332 /* Find any new threads that might have been created, and update
333 inferior_ptid to the active thread.
334
335 Only do it if the program is still alive, though. Otherwise,
336 this causes problems when debugging through the remote protocol,
337 because we might try switching threads (and thus sending packets)
338 after the remote has disconnected. */
339 if (status->kind != TARGET_WAITKIND_EXITED
340 && status->kind != TARGET_WAITKIND_SIGNALLED)
341 {
3b1b69bf 342 inferior_ptid = event_ptid;
f6ac5f3d 343 this->update_thread_list ();
bed0c243
JB
344 ravenscar_update_inferior_ptid ();
345 }
036b1ba8
JB
346 return inferior_ptid;
347}
348
349/* Add the thread associated to the given TASK to the thread list
350 (if the thread has already been added, this is a no-op). */
351
352static void
353ravenscar_add_thread (struct ada_task_info *task)
354{
355 if (find_thread_ptid (task->ptid) == NULL)
356 add_thread (task->ptid);
357}
358
f6ac5f3d
PA
359void
360ravenscar_thread_target::update_thread_list ()
036b1ba8 361{
79779fa9 362 ada_build_task_list ();
036b1ba8
JB
363
364 /* Do not clear the thread list before adding the Ada task, to keep
365 the thread that the process stratum has included into it
366 (base_ptid) and the running thread, that may not have been included
367 to system.tasking.debug's list yet. */
368
369 iterate_over_live_ada_tasks (ravenscar_add_thread);
370}
371
372static ptid_t
9edcc12f 373ravenscar_active_task (int cpu)
036b1ba8 374{
9edcc12f 375 CORE_ADDR tid = get_running_thread_id (cpu);
036b1ba8
JB
376
377 if (tid == 0)
378 return null_ptid;
379 else
e99b03dc 380 return ptid_t (base_ptid.pid (), 0, tid);
036b1ba8
JB
381}
382
f6ac5f3d
PA
383const char *
384ravenscar_thread_target::extra_thread_info (thread_info *tp)
036b1ba8
JB
385{
386 return "Ravenscar task";
387}
388
57810aa7 389bool
f6ac5f3d 390ravenscar_thread_target::thread_alive (ptid_t ptid)
036b1ba8
JB
391{
392 /* Ravenscar tasks are non-terminating. */
57810aa7 393 return true;
036b1ba8
JB
394}
395
f6ac5f3d
PA
396const char *
397ravenscar_thread_target::pid_to_str (ptid_t ptid)
036b1ba8
JB
398{
399 static char buf[30];
400
cc6bcb54 401 snprintf (buf, sizeof (buf), "Thread %#x", (int) ptid.tid ());
036b1ba8
JB
402 return buf;
403}
404
f6ac5f3d
PA
405void
406ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
036b1ba8 407{
222312d3 408 ptid_t ptid = regcache->ptid ();
036b1ba8 409
9edcc12f
JB
410 if (ravenscar_runtime_initialized ()
411 && is_ravenscar_task (ptid)
412 && !ravenscar_task_is_currently_active (ptid))
7e35103a 413 {
ac7936df 414 struct gdbarch *gdbarch = regcache->arch ();
7e35103a
JB
415 struct ravenscar_arch_ops *arch_ops
416 = gdbarch_ravenscar_ops (gdbarch);
417
418 arch_ops->to_fetch_registers (regcache, regnum);
419 }
9edcc12f 420 else
d6ca69cd 421 beneath ()->fetch_registers (regcache, regnum);
036b1ba8
JB
422}
423
f6ac5f3d
PA
424void
425ravenscar_thread_target::store_registers (struct regcache *regcache,
426 int regnum)
036b1ba8 427{
222312d3 428 ptid_t ptid = regcache->ptid ();
036b1ba8 429
9edcc12f
JB
430 if (ravenscar_runtime_initialized ()
431 && is_ravenscar_task (ptid)
432 && !ravenscar_task_is_currently_active (ptid))
7e35103a 433 {
ac7936df 434 struct gdbarch *gdbarch = regcache->arch ();
7e35103a
JB
435 struct ravenscar_arch_ops *arch_ops
436 = gdbarch_ravenscar_ops (gdbarch);
437
494f80a9 438 arch_ops->to_store_registers (regcache, regnum);
7e35103a 439 }
9edcc12f 440 else
d6ca69cd 441 beneath ()->store_registers (regcache, regnum);
036b1ba8
JB
442}
443
f6ac5f3d
PA
444void
445ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
036b1ba8 446{
222312d3 447 ptid_t ptid = regcache->ptid ();
036b1ba8 448
9edcc12f
JB
449 if (ravenscar_runtime_initialized ()
450 && is_ravenscar_task (ptid)
451 && !ravenscar_task_is_currently_active (ptid))
7e35103a 452 {
ac7936df 453 struct gdbarch *gdbarch = regcache->arch ();
7e35103a
JB
454 struct ravenscar_arch_ops *arch_ops
455 = gdbarch_ravenscar_ops (gdbarch);
456
494f80a9 457 arch_ops->to_prepare_to_store (regcache);
7e35103a 458 }
9edcc12f 459 else
d6ca69cd 460 beneath ()->prepare_to_store (regcache);
036b1ba8
JB
461}
462
e02544b2
JB
463/* Implement the to_stopped_by_sw_breakpoint target_ops "method". */
464
57810aa7 465bool
f6ac5f3d 466ravenscar_thread_target::stopped_by_sw_breakpoint ()
e02544b2
JB
467{
468 ptid_t saved_ptid = inferior_ptid;
57810aa7 469 bool result;
e02544b2 470
9edcc12f 471 inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
d6ca69cd 472 result = beneath ()->stopped_by_sw_breakpoint ();
e02544b2
JB
473 inferior_ptid = saved_ptid;
474 return result;
475}
476
477/* Implement the to_stopped_by_hw_breakpoint target_ops "method". */
478
57810aa7 479bool
f6ac5f3d 480ravenscar_thread_target::stopped_by_hw_breakpoint ()
e02544b2
JB
481{
482 ptid_t saved_ptid = inferior_ptid;
57810aa7 483 bool result;
e02544b2 484
9edcc12f 485 inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
d6ca69cd 486 result = beneath ()->stopped_by_hw_breakpoint ();
e02544b2
JB
487 inferior_ptid = saved_ptid;
488 return result;
489}
490
491/* Implement the to_stopped_by_watchpoint target_ops "method". */
492
57810aa7 493bool
f6ac5f3d 494ravenscar_thread_target::stopped_by_watchpoint ()
e02544b2
JB
495{
496 ptid_t saved_ptid = inferior_ptid;
57810aa7 497 bool result;
e02544b2 498
9edcc12f 499 inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
d6ca69cd 500 result = beneath ()->stopped_by_watchpoint ();
e02544b2
JB
501 inferior_ptid = saved_ptid;
502 return result;
503}
504
505/* Implement the to_stopped_data_address target_ops "method". */
506
57810aa7 507bool
f6ac5f3d 508ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
e02544b2
JB
509{
510 ptid_t saved_ptid = inferior_ptid;
57810aa7 511 bool result;
e02544b2 512
9edcc12f 513 inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
d6ca69cd 514 result = beneath ()->stopped_data_address (addr_p);
e02544b2
JB
515 inferior_ptid = saved_ptid;
516 return result;
517}
518
f6ac5f3d
PA
519void
520ravenscar_thread_target::mourn_inferior ()
036b1ba8 521{
036b1ba8 522 base_ptid = null_ptid;
d6ca69cd 523 beneath ()->mourn_inferior ();
036b1ba8
JB
524 unpush_target (&ravenscar_ops);
525}
526
e02544b2
JB
527/* Implement the to_core_of_thread target_ops "method". */
528
f6ac5f3d
PA
529int
530ravenscar_thread_target::core_of_thread (ptid_t ptid)
e02544b2
JB
531{
532 ptid_t saved_ptid = inferior_ptid;
e02544b2
JB
533 int result;
534
9edcc12f 535 inferior_ptid = get_base_thread_from_ravenscar_task (saved_ptid);
d6ca69cd 536 result = beneath ()->core_of_thread (inferior_ptid);
e02544b2
JB
537 inferior_ptid = saved_ptid;
538 return result;
539}
540
036b1ba8
JB
541/* Observer on inferior_created: push ravenscar thread stratum if needed. */
542
543static void
544ravenscar_inferior_created (struct target_ops *target, int from_tty)
545{
cf3fbed4 546 const char *err_msg;
7e35103a
JB
547
548 if (!ravenscar_task_support
7dc7c195 549 || gdbarch_ravenscar_ops (target_gdbarch ()) == NULL
7e35103a 550 || !has_ravenscar_runtime ())
25abf4de
JB
551 return;
552
cf3fbed4
JB
553 err_msg = ada_get_tcb_types_info ();
554 if (err_msg != NULL)
555 {
8f6cb6c3 556 warning (_("%s. Task/thread support disabled."), err_msg);
cf3fbed4
JB
557 return;
558 }
559
25abf4de
JB
560 ravenscar_update_inferior_ptid ();
561 push_target (&ravenscar_ops);
036b1ba8
JB
562}
563
f6ac5f3d
PA
564ptid_t
565ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
036b1ba8 566{
e99b03dc 567 return ptid_t (base_ptid.pid (), 0, thread);
036b1ba8
JB
568}
569
036b1ba8
JB
570/* Command-list for the "set/show ravenscar" prefix command. */
571static struct cmd_list_element *set_ravenscar_list;
572static struct cmd_list_element *show_ravenscar_list;
573
574/* Implement the "set ravenscar" prefix command. */
575
576static void
981a3fb3 577set_ravenscar_command (const char *arg, int from_tty)
036b1ba8
JB
578{
579 printf_unfiltered (_(\
580"\"set ravenscar\" must be followed by the name of a setting.\n"));
635c7e8a 581 help_list (set_ravenscar_list, "set ravenscar ", all_commands, gdb_stdout);
036b1ba8
JB
582}
583
584/* Implement the "show ravenscar" prefix command. */
585
586static void
981a3fb3 587show_ravenscar_command (const char *args, int from_tty)
036b1ba8
JB
588{
589 cmd_show_list (show_ravenscar_list, from_tty, "");
590}
591
592/* Implement the "show ravenscar task-switching" command. */
593
594static void
595show_ravenscar_task_switching_command (struct ui_file *file, int from_tty,
596 struct cmd_list_element *c,
597 const char *value)
598{
599 if (ravenscar_task_support)
600 fprintf_filtered (file, _("\
b64edec4 601Support for Ravenscar task/thread switching is enabled\n"));
036b1ba8
JB
602 else
603 fprintf_filtered (file, _("\
b64edec4 604Support for Ravenscar task/thread switching is disabled\n"));
036b1ba8
JB
605}
606
607/* Module startup initialization function, automagically called by
608 init.c. */
609
610void
611_initialize_ravenscar (void)
612{
036b1ba8
JB
613 base_ptid = null_ptid;
614
615 /* Notice when the inferior is created in order to push the
616 ravenscar ops if needed. */
76727919 617 gdb::observers::inferior_created.attach (ravenscar_inferior_created);
036b1ba8 618
036b1ba8
JB
619 add_prefix_cmd ("ravenscar", no_class, set_ravenscar_command,
620 _("Prefix command for changing Ravenscar-specific settings"),
621 &set_ravenscar_list, "set ravenscar ", 0, &setlist);
622
623 add_prefix_cmd ("ravenscar", no_class, show_ravenscar_command,
624 _("Prefix command for showing Ravenscar-specific settings"),
04f9d4d0 625 &show_ravenscar_list, "show ravenscar ", 0, &showlist);
036b1ba8
JB
626
627 add_setshow_boolean_cmd ("task-switching", class_obscure,
628 &ravenscar_task_support, _("\
629Enable or disable support for GNAT Ravenscar tasks"), _("\
630Show whether support for GNAT Ravenscar tasks is enabled"),
631 _("\
632Enable or disable support for task/thread switching with the GNAT\n\
633Ravenscar run-time library for bareboard configuration."),
634 NULL, show_ravenscar_task_switching_command,
635 &set_ravenscar_list, &show_ravenscar_list);
636}