Change regcache list to be an hash map
[deliverable/binutils-gdb.git] / gdb / ravenscar-thread.c
CommitLineData
036b1ba8
JB
1/* Ada Ravenscar thread support.
2
b811d2c2 3 Copyright (C) 2004-2020 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
e397fd39 39 about high-level concepts such as threads, only about some code
9edcc12f
JB
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
e397fd39 47 on the list of Ada tasks, with one thread per Ada task. The convention
9edcc12f 48 is that threads corresponding to the CPUs (see assumption above)
e397fd39 49 have a ptid_t of the form (PID, LWP, 0), while threads corresponding
9edcc12f
JB
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
e397fd39
TT
53 Switching to a given Ada task (or its underlying thread) is performed
54 by fetching the registers of that task from the memory area where
9edcc12f
JB
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
491144b5
CB
60/* If true, ravenscar task support is enabled. */
61static bool ravenscar_task_support = true;
036b1ba8 62
7f39f34a 63static const char running_thread_name[] = "__gnat_running_thread_table";
036b1ba8
JB
64
65static const char known_tasks_name[] = "system__tasking__debug__known_tasks";
6040a59d 66static const char first_task_name[] = "system__tasking__debug__first_task";
036b1ba8 67
6cbcc006
TT
68static const char ravenscar_runtime_initializer[]
69 = "system__bb__threads__initialize";
036b1ba8 70
d9f719f1
PA
71static const target_info ravenscar_target_info = {
72 "ravenscar",
73 N_("Ravenscar tasks."),
74 N_("Ravenscar tasks support.")
75};
76
f6ac5f3d
PA
77struct ravenscar_thread_target final : public target_ops
78{
0b790b1e 79 ravenscar_thread_target ()
2da4b788 80 : m_base_ptid (inferior_ptid)
0b790b1e 81 {
2da4b788
PA
82 thread_info *thr = add_active_thread ();
83 if (thr != nullptr)
84 switch_to_thread (thr);
0b790b1e
TT
85 }
86
d9f719f1
PA
87 const target_info &info () const override
88 { return ravenscar_target_info; }
f6ac5f3d 89
66b4deae
PA
90 strata stratum () const override { return thread_stratum; }
91
f6ac5f3d
PA
92 ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
93 void resume (ptid_t, int, enum gdb_signal) override;
94
95 void fetch_registers (struct regcache *, int) override;
96 void store_registers (struct regcache *, int) override;
97
98 void prepare_to_store (struct regcache *) override;
99
57810aa7 100 bool stopped_by_sw_breakpoint () override;
f6ac5f3d 101
57810aa7 102 bool stopped_by_hw_breakpoint () override;
f6ac5f3d 103
57810aa7 104 bool stopped_by_watchpoint () override;
f6ac5f3d 105
57810aa7 106 bool stopped_data_address (CORE_ADDR *) override;
f6ac5f3d 107
57810aa7 108 bool thread_alive (ptid_t ptid) override;
f6ac5f3d
PA
109
110 int core_of_thread (ptid_t ptid) override;
111
112 void update_thread_list () override;
113
114 const char *extra_thread_info (struct thread_info *) override;
115
a068643d 116 std::string pid_to_str (ptid_t) override;
f6ac5f3d
PA
117
118 ptid_t get_ada_task_ptid (long lwp, long thread) override;
119
120 void mourn_inferior () override;
f6ac5f3d 121
0b790b1e
TT
122 void close () override
123 {
124 delete this;
125 }
126
127private:
f6ac5f3d 128
0b790b1e
TT
129 /* PTID of the last thread that received an event.
130 This can be useful to determine the associated task that received
131 the event, to make it the current task. */
2da4b788 132 ptid_t m_base_ptid;
0b790b1e 133
2da4b788 134 thread_info *add_active_thread ();
0b790b1e
TT
135 ptid_t active_task (int cpu);
136 bool task_is_currently_active (ptid_t ptid);
137 bool runtime_initialized ();
138};
036b1ba8 139
989f3c58 140/* Return true iff PTID corresponds to a ravenscar task. */
9edcc12f 141
989f3c58 142static bool
9edcc12f
JB
143is_ravenscar_task (ptid_t ptid)
144{
54aa6c67
JB
145 /* By construction, ravenscar tasks have their LWP set to zero.
146 Also make sure that the TID is nonzero, as some remotes, when
147 asked for the list of threads, will return the first thread
148 as having its TID set to zero. For instance, TSIM version
149 2.0.48 for LEON3 sends 'm0' as a reply to the 'qfThreadInfo'
150 query, which the remote protocol layer then treats as a thread
151 whose TID is 0. This is obviously not a ravenscar task. */
cc6bcb54 152 return ptid.lwp () == 0 && ptid.tid () != 0;
9edcc12f
JB
153}
154
155/* Given PTID, which can be either a ravenscar task or a CPU thread,
156 return which CPU that ptid is running on.
157
158 This assume that PTID is a valid ptid_t. Otherwise, a gdb_assert
159 will be triggered. */
160
161static int
162ravenscar_get_thread_base_cpu (ptid_t ptid)
163{
164 int base_cpu;
165
166 if (is_ravenscar_task (ptid))
167 {
168 struct ada_task_info *task_info = ada_get_task_info_from_ptid (ptid);
169
170 gdb_assert (task_info != NULL);
171 base_cpu = task_info->base_cpu;
172 }
173 else
174 {
175 /* We assume that the LWP of the PTID is equal to the CPU number. */
e38504b3 176 base_cpu = ptid.lwp ();
9edcc12f
JB
177 }
178
179 return base_cpu;
180}
181
989f3c58 182/* Given a ravenscar task (identified by its ptid_t PTID), return true
9edcc12f
JB
183 if this task is the currently active task on the cpu that task is
184 running on.
185
186 In other words, this function determine which CPU this task is
187 currently running on, and then return nonzero if the CPU in question
188 is executing the code for that task. If that's the case, then
189 that task's registers are in the CPU bank. Otherwise, the task
190 is currently suspended, and its registers have been saved in memory. */
191
0b790b1e
TT
192bool
193ravenscar_thread_target::task_is_currently_active (ptid_t ptid)
9edcc12f
JB
194{
195 ptid_t active_task_ptid
0b790b1e 196 = active_task (ravenscar_get_thread_base_cpu (ptid));
9edcc12f 197
d7e15655 198 return ptid == active_task_ptid;
9edcc12f
JB
199}
200
201/* Return the CPU thread (as a ptid_t) on which the given ravenscar
202 task is running.
203
204 This is the thread that corresponds to the CPU on which the task
205 is running. */
206
207static ptid_t
208get_base_thread_from_ravenscar_task (ptid_t ptid)
209{
210 int base_cpu;
211
212 if (!is_ravenscar_task (ptid))
213 return ptid;
214
215 base_cpu = ravenscar_get_thread_base_cpu (ptid);
e99b03dc 216 return ptid_t (ptid.pid (), base_cpu, 0);
9edcc12f
JB
217}
218
2da4b788
PA
219/* Fetch the ravenscar running thread from target memory, make sure
220 there's a corresponding thread in the thread list, and return it.
221 If the runtime is not initialized, return NULL. */
036b1ba8 222
2da4b788
PA
223thread_info *
224ravenscar_thread_target::add_active_thread ()
036b1ba8 225{
5b6d1e4f
PA
226 process_stratum_target *proc_target
227 = as_process_stratum_target (this->beneath ());
228
9edcc12f
JB
229 int base_cpu;
230
2da4b788 231 gdb_assert (!is_ravenscar_task (m_base_ptid));
0b790b1e 232 base_cpu = ravenscar_get_thread_base_cpu (m_base_ptid);
9edcc12f 233
0b790b1e 234 if (!runtime_initialized ())
2da4b788 235 return nullptr;
036b1ba8 236
0b790b1e 237 /* Make sure we set m_base_ptid before calling active_task
036b1ba8 238 as the latter relies on it. */
2da4b788
PA
239 ptid_t active_ptid = active_task (base_cpu);
240 gdb_assert (active_ptid != null_ptid);
036b1ba8
JB
241
242 /* The running thread may not have been added to
e8032dde 243 system.tasking.debug's list yet; so ravenscar_update_thread_list
036b1ba8 244 may not always add it to the thread list. Add it here. */
2da4b788
PA
245 thread_info *active_thr = find_thread_ptid (proc_target, active_ptid);
246 if (active_thr == nullptr)
247 active_thr = add_thread (proc_target, active_ptid);
248 return active_thr;
036b1ba8
JB
249}
250
7f39f34a
JB
251/* The Ravenscar Runtime exports a symbol which contains the ID of
252 the thread that is currently running. Try to locate that symbol
253 and return its associated minimal symbol.
254 Return NULL if not found. */
255
3b7344d5 256static struct bound_minimal_symbol
989f3c58 257get_running_thread_msymbol ()
7f39f34a 258{
3b7344d5 259 struct bound_minimal_symbol msym;
7f39f34a
JB
260
261 msym = lookup_minimal_symbol (running_thread_name, NULL, NULL);
3b7344d5 262 if (!msym.minsym)
7f39f34a
JB
263 /* Older versions of the GNAT runtime were using a different
264 (less ideal) name for the symbol where the active thread ID
265 is stored. If we couldn't find the symbol using the latest
266 name, then try the old one. */
267 msym = lookup_minimal_symbol ("running_thread", NULL, NULL);
268
269 return msym;
270}
271
036b1ba8
JB
272/* Return True if the Ada Ravenscar run-time can be found in the
273 application. */
274
989f3c58
TT
275static bool
276has_ravenscar_runtime ()
036b1ba8 277{
6cbcc006
TT
278 struct bound_minimal_symbol msym_ravenscar_runtime_initializer
279 = lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL);
280 struct bound_minimal_symbol msym_known_tasks
281 = lookup_minimal_symbol (known_tasks_name, NULL, NULL);
282 struct bound_minimal_symbol msym_first_task
283 = lookup_minimal_symbol (first_task_name, NULL, NULL);
3b7344d5
TT
284 struct bound_minimal_symbol msym_running_thread
285 = get_running_thread_msymbol ();
036b1ba8 286
3b7344d5
TT
287 return (msym_ravenscar_runtime_initializer.minsym
288 && (msym_known_tasks.minsym || msym_first_task.minsym)
289 && msym_running_thread.minsym);
036b1ba8
JB
290}
291
292/* Return True if the Ada Ravenscar run-time can be found in the
293 application, and if it has been initialized on target. */
294
0b790b1e
TT
295bool
296ravenscar_thread_target::runtime_initialized ()
036b1ba8 297{
0b790b1e 298 return active_task (1) != null_ptid;
036b1ba8
JB
299}
300
7f39f34a
JB
301/* Return the ID of the thread that is currently running.
302 Return 0 if the ID could not be determined. */
036b1ba8
JB
303
304static CORE_ADDR
9edcc12f 305get_running_thread_id (int cpu)
036b1ba8 306{
3b7344d5 307 struct bound_minimal_symbol object_msym = get_running_thread_msymbol ();
036b1ba8
JB
308 int object_size;
309 int buf_size;
948f8e3d 310 gdb_byte *buf;
036b1ba8 311 CORE_ADDR object_addr;
6cbcc006
TT
312 struct type *builtin_type_void_data_ptr
313 = builtin_type (target_gdbarch ())->builtin_data_ptr;
036b1ba8 314
3b7344d5 315 if (!object_msym.minsym)
036b1ba8
JB
316 return 0;
317
036b1ba8 318 object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
9edcc12f
JB
319 object_addr = (BMSYMBOL_VALUE_ADDRESS (object_msym)
320 + (cpu - 1) * object_size);
036b1ba8 321 buf_size = object_size;
224c3ddb 322 buf = (gdb_byte *) alloca (buf_size);
036b1ba8
JB
323 read_memory (object_addr, buf, buf_size);
324 return extract_typed_address (buf, builtin_type_void_data_ptr);
325}
326
f6ac5f3d 327void
6cbcc006
TT
328ravenscar_thread_target::resume (ptid_t ptid, int step,
329 enum gdb_signal siggnal)
036b1ba8 330{
485b851b
TT
331 /* If we see a wildcard resume, we simply pass that on. Otherwise,
332 arrange to resume the base ptid. */
0b790b1e 333 inferior_ptid = m_base_ptid;
485b851b
TT
334 if (ptid != minus_one_ptid)
335 ptid = m_base_ptid;
336 beneath ()->resume (ptid, step, siggnal);
036b1ba8
JB
337}
338
f6ac5f3d
PA
339ptid_t
340ravenscar_thread_target::wait (ptid_t ptid,
341 struct target_waitstatus *status,
342 int options)
036b1ba8 343{
5b6d1e4f
PA
344 process_stratum_target *beneath
345 = as_process_stratum_target (this->beneath ());
3b1b69bf 346 ptid_t event_ptid;
036b1ba8 347
485b851b
TT
348 if (ptid != minus_one_ptid)
349 ptid = m_base_ptid;
5b6d1e4f 350 event_ptid = beneath->wait (ptid, status, 0);
2da4b788
PA
351 /* Find any new threads that might have been created, and return the
352 active thread.
bed0c243
JB
353
354 Only do it if the program is still alive, though. Otherwise,
355 this causes problems when debugging through the remote protocol,
356 because we might try switching threads (and thus sending packets)
357 after the remote has disconnected. */
358 if (status->kind != TARGET_WAITKIND_EXITED
359 && status->kind != TARGET_WAITKIND_SIGNALLED)
360 {
2da4b788 361 m_base_ptid = event_ptid;
f6ac5f3d 362 this->update_thread_list ();
2da4b788 363 return this->add_active_thread ()->ptid;
bed0c243 364 }
2da4b788 365 return m_base_ptid;
036b1ba8
JB
366}
367
368/* Add the thread associated to the given TASK to the thread list
369 (if the thread has already been added, this is a no-op). */
370
371static void
372ravenscar_add_thread (struct ada_task_info *task)
373{
5b6d1e4f
PA
374 if (find_thread_ptid (current_inferior (), task->ptid) == NULL)
375 add_thread (current_inferior ()->process_target (), task->ptid);
036b1ba8
JB
376}
377
f6ac5f3d
PA
378void
379ravenscar_thread_target::update_thread_list ()
036b1ba8 380{
036b1ba8
JB
381 /* Do not clear the thread list before adding the Ada task, to keep
382 the thread that the process stratum has included into it
0b790b1e 383 (m_base_ptid) and the running thread, that may not have been included
036b1ba8
JB
384 to system.tasking.debug's list yet. */
385
386 iterate_over_live_ada_tasks (ravenscar_add_thread);
387}
388
0b790b1e
TT
389ptid_t
390ravenscar_thread_target::active_task (int cpu)
036b1ba8 391{
9edcc12f 392 CORE_ADDR tid = get_running_thread_id (cpu);
036b1ba8
JB
393
394 if (tid == 0)
395 return null_ptid;
396 else
0b790b1e 397 return ptid_t (m_base_ptid.pid (), 0, tid);
036b1ba8
JB
398}
399
f6ac5f3d
PA
400const char *
401ravenscar_thread_target::extra_thread_info (thread_info *tp)
036b1ba8
JB
402{
403 return "Ravenscar task";
404}
405
57810aa7 406bool
f6ac5f3d 407ravenscar_thread_target::thread_alive (ptid_t ptid)
036b1ba8
JB
408{
409 /* Ravenscar tasks are non-terminating. */
57810aa7 410 return true;
036b1ba8
JB
411}
412
a068643d 413std::string
f6ac5f3d 414ravenscar_thread_target::pid_to_str (ptid_t ptid)
036b1ba8 415{
a068643d 416 return string_printf ("Thread %#x", (int) ptid.tid ());
036b1ba8
JB
417}
418
f6ac5f3d
PA
419void
420ravenscar_thread_target::fetch_registers (struct regcache *regcache, int regnum)
036b1ba8 421{
222312d3 422 ptid_t ptid = regcache->ptid ();
036b1ba8 423
0b790b1e 424 if (runtime_initialized ()
9edcc12f 425 && is_ravenscar_task (ptid)
0b790b1e 426 && !task_is_currently_active (ptid))
7e35103a 427 {
ac7936df 428 struct gdbarch *gdbarch = regcache->arch ();
7e35103a
JB
429 struct ravenscar_arch_ops *arch_ops
430 = gdbarch_ravenscar_ops (gdbarch);
431
7657f14d 432 arch_ops->fetch_registers (regcache, regnum);
7e35103a 433 }
9edcc12f 434 else
d6ca69cd 435 beneath ()->fetch_registers (regcache, regnum);
036b1ba8
JB
436}
437
f6ac5f3d
PA
438void
439ravenscar_thread_target::store_registers (struct regcache *regcache,
440 int regnum)
036b1ba8 441{
222312d3 442 ptid_t ptid = regcache->ptid ();
036b1ba8 443
0b790b1e 444 if (runtime_initialized ()
9edcc12f 445 && is_ravenscar_task (ptid)
0b790b1e 446 && !task_is_currently_active (ptid))
7e35103a 447 {
ac7936df 448 struct gdbarch *gdbarch = regcache->arch ();
7e35103a
JB
449 struct ravenscar_arch_ops *arch_ops
450 = gdbarch_ravenscar_ops (gdbarch);
451
7657f14d 452 arch_ops->store_registers (regcache, regnum);
7e35103a 453 }
9edcc12f 454 else
d6ca69cd 455 beneath ()->store_registers (regcache, regnum);
036b1ba8
JB
456}
457
f6ac5f3d
PA
458void
459ravenscar_thread_target::prepare_to_store (struct regcache *regcache)
036b1ba8 460{
222312d3 461 ptid_t ptid = regcache->ptid ();
036b1ba8 462
0b790b1e 463 if (runtime_initialized ()
9edcc12f 464 && is_ravenscar_task (ptid)
0b790b1e 465 && !task_is_currently_active (ptid))
7e35103a 466 {
7657f14d 467 /* Nothing. */
7e35103a 468 }
9edcc12f 469 else
d6ca69cd 470 beneath ()->prepare_to_store (regcache);
036b1ba8
JB
471}
472
e02544b2
JB
473/* Implement the to_stopped_by_sw_breakpoint target_ops "method". */
474
57810aa7 475bool
f6ac5f3d 476ravenscar_thread_target::stopped_by_sw_breakpoint ()
e02544b2 477{
5b6ea500
TT
478 scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
479 inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
480 return beneath ()->stopped_by_sw_breakpoint ();
e02544b2
JB
481}
482
483/* Implement the to_stopped_by_hw_breakpoint target_ops "method". */
484
57810aa7 485bool
f6ac5f3d 486ravenscar_thread_target::stopped_by_hw_breakpoint ()
e02544b2 487{
5b6ea500
TT
488 scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
489 inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
490 return beneath ()->stopped_by_hw_breakpoint ();
e02544b2
JB
491}
492
493/* Implement the to_stopped_by_watchpoint target_ops "method". */
494
57810aa7 495bool
f6ac5f3d 496ravenscar_thread_target::stopped_by_watchpoint ()
e02544b2 497{
5b6ea500
TT
498 scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
499 inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
500 return beneath ()->stopped_by_watchpoint ();
e02544b2
JB
501}
502
503/* Implement the to_stopped_data_address target_ops "method". */
504
57810aa7 505bool
f6ac5f3d 506ravenscar_thread_target::stopped_data_address (CORE_ADDR *addr_p)
e02544b2 507{
5b6ea500
TT
508 scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
509 inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
510 return beneath ()->stopped_data_address (addr_p);
e02544b2
JB
511}
512
f6ac5f3d
PA
513void
514ravenscar_thread_target::mourn_inferior ()
036b1ba8 515{
0b790b1e 516 m_base_ptid = null_ptid;
fd9faca8 517 target_ops *beneath = this->beneath ();
0b790b1e 518 unpush_target (this);
fd9faca8 519 beneath->mourn_inferior ();
036b1ba8
JB
520}
521
e02544b2
JB
522/* Implement the to_core_of_thread target_ops "method". */
523
f6ac5f3d
PA
524int
525ravenscar_thread_target::core_of_thread (ptid_t ptid)
e02544b2 526{
5b6ea500
TT
527 scoped_restore save_ptid = make_scoped_restore (&inferior_ptid);
528 inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
529 return beneath ()->core_of_thread (inferior_ptid);
e02544b2
JB
530}
531
036b1ba8
JB
532/* Observer on inferior_created: push ravenscar thread stratum if needed. */
533
534static void
535ravenscar_inferior_created (struct target_ops *target, int from_tty)
536{
cf3fbed4 537 const char *err_msg;
7e35103a
JB
538
539 if (!ravenscar_task_support
7dc7c195 540 || gdbarch_ravenscar_ops (target_gdbarch ()) == NULL
7e35103a 541 || !has_ravenscar_runtime ())
25abf4de
JB
542 return;
543
cf3fbed4
JB
544 err_msg = ada_get_tcb_types_info ();
545 if (err_msg != NULL)
546 {
8f6cb6c3 547 warning (_("%s. Task/thread support disabled."), err_msg);
cf3fbed4
JB
548 return;
549 }
550
0b790b1e
TT
551 target_ops_up target_holder (new ravenscar_thread_target ());
552 push_target (std::move (target_holder));
036b1ba8
JB
553}
554
f6ac5f3d
PA
555ptid_t
556ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
036b1ba8 557{
0b790b1e 558 return ptid_t (m_base_ptid.pid (), 0, thread);
036b1ba8
JB
559}
560
036b1ba8
JB
561/* Command-list for the "set/show ravenscar" prefix command. */
562static struct cmd_list_element *set_ravenscar_list;
563static struct cmd_list_element *show_ravenscar_list;
564
036b1ba8
JB
565/* Implement the "show ravenscar task-switching" command. */
566
567static void
568show_ravenscar_task_switching_command (struct ui_file *file, int from_tty,
569 struct cmd_list_element *c,
570 const char *value)
571{
572 if (ravenscar_task_support)
573 fprintf_filtered (file, _("\
b64edec4 574Support for Ravenscar task/thread switching is enabled\n"));
036b1ba8
JB
575 else
576 fprintf_filtered (file, _("\
b64edec4 577Support for Ravenscar task/thread switching is disabled\n"));
036b1ba8
JB
578}
579
580/* Module startup initialization function, automagically called by
581 init.c. */
582
6c265988 583void _initialize_ravenscar ();
036b1ba8 584void
989f3c58 585_initialize_ravenscar ()
036b1ba8 586{
036b1ba8
JB
587 /* Notice when the inferior is created in order to push the
588 ravenscar ops if needed. */
76727919 589 gdb::observers::inferior_created.attach (ravenscar_inferior_created);
036b1ba8 590
0743fc83
TT
591 add_basic_prefix_cmd ("ravenscar", no_class,
592 _("Prefix command for changing Ravenscar-specific settings."),
593 &set_ravenscar_list, "set ravenscar ", 0, &setlist);
036b1ba8 594
0743fc83
TT
595 add_show_prefix_cmd ("ravenscar", no_class,
596 _("Prefix command for showing Ravenscar-specific settings."),
597 &show_ravenscar_list, "show ravenscar ", 0, &showlist);
036b1ba8
JB
598
599 add_setshow_boolean_cmd ("task-switching", class_obscure,
600 &ravenscar_task_support, _("\
590042fc
PW
601Enable or disable support for GNAT Ravenscar tasks."), _("\
602Show whether support for GNAT Ravenscar tasks is enabled."),
036b1ba8
JB
603 _("\
604Enable or disable support for task/thread switching with the GNAT\n\
605Ravenscar run-time library for bareboard configuration."),
606 NULL, show_ravenscar_task_switching_command,
607 &set_ravenscar_list, &show_ravenscar_list);
608}
This page took 1.027153 seconds and 4 git commands to generate.