Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH 01/18] Some ada-lang/ada-tasks routines needed by the VxWorks target
Date: Thu, 24 Feb 2011 17:49:00 -0000	[thread overview]
Message-ID: <1298569763-18784-2-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1298569763-18784-1-git-send-email-brobecker@adacore.com>

We need to add a few routines in the following units...

  - ada-lang.c:
      After switching to a new partition, if there is an Ada main in there,
      and the language is auto, switch the language to Ada (if not already
      Ada).

  - ada-tasks.c:
      The remote-wtx backend needs to know which task is the environment
      task (this is the initial/main task).  The program dies when this
      task dies...

gdb/ChangeLog:

        * ada-lang.h (ada_language_auto_set, ada_get_environment_task):
        Add declarations.
        * ada-lang.c (ada_language_auto_set): New function.
        * ada-tasks.c (ada_get_environment_task): New function.
---
 gdb/ada-lang.c  |   14 ++++++++++++++
 gdb/ada-lang.h  |    4 ++++
 gdb/ada-tasks.c |   16 ++++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 467e4df..a325e81 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -740,6 +740,20 @@ ada_update_initial_language (enum language lang)
   return lang;
 }
 
+/* If the language mode is auto, and we can find some Ada code
+   in one of the module, then automatically set the language to Ada.  */
+
+void
+ada_language_auto_set (void)
+{
+  if (language_mode == language_mode_auto
+      && ada_update_initial_language (language_unknown) == language_ada)
+    {
+      set_language (language_ada);
+      expected_language = current_language;
+    }
+}
+
 /* If the main procedure is written in Ada, then return its name.
    The result is good until the next call.  Return NULL if the main
    procedure doesn't appear to be in Ada.  */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 7902124..9a0e8ed 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -215,6 +215,8 @@ extern const char *ada_decode (const char*);
 
 extern enum language ada_update_initial_language (enum language);
 
+extern void ada_language_auto_set (void);
+
 extern void clear_ada_sym_cache (void);
 
 extern int ada_lookup_symbol_list (const char *, const struct block *,
@@ -377,6 +379,8 @@ extern char *ada_main_name (void);
 
 extern int valid_task_id (int);
 
+extern struct ada_task_info *ada_get_environment_task (void);
+
 extern int ada_get_task_number (ptid_t);
 
 typedef void (ada_task_list_iterator_ftype) (struct ada_task_info *task);
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 216902a..d132ec7 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -212,6 +212,22 @@ ada_task_is_alive (struct ada_task_info *task_info)
   return (task_info->state != Terminated);
 }
 
+/* Return the task info associated to the Environment Task.
+   This function assumes that the inferior does in fact use tasking.  */
+
+struct ada_task_info *
+ada_get_environment_task (void)
+{
+  ada_build_task_list (0);
+  gdb_assert (VEC_length (ada_task_info_s, task_list) > 0);
+
+  /* We use a little bit of insider knowledge to determine which task
+     is the Environment Task:  We know that this task is created first,
+     and thus should always be task #1, which is at index 0 of the
+     TASK_LIST.  */
+  return (VEC_index (ada_task_info_s, task_list, 0));
+}
+
 /* Call the ITERATOR function once for each Ada task that hasn't been
    terminated yet.  */
 
-- 
1.7.0.4


  reply	other threads:[~2011-02-24 17:49 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 17:49 Add support for VxWorks 5.x, 6.x and 653 Joel Brobecker
2011-02-24 17:49 ` Joel Brobecker [this message]
2011-02-24 17:50 ` [PATCH 04/18] add new "unload" command (symetry of existing "load" command) Joel Brobecker
2011-02-24 19:22   ` Eli Zaretskii
2011-02-24 17:50 ` [PATCH 03/18] New general purpose routines in utils.c Joel Brobecker
2011-02-24 19:06   ` Tom Tromey
2011-02-24 17:50 ` [PATCH 02/18] New command_post observer Joel Brobecker
2011-02-24 18:58   ` Tom Tromey
2011-02-24 17:51 ` [PATCH 05/18] new struct bp_target_info target_private_data field Joel Brobecker
2011-02-24 17:54 ` [PATCH 06/18] New module remote-wtx-utils Joel Brobecker
2011-02-24 19:26   ` Tom Tromey
2011-02-24 17:54 ` [PATCH 09/18] VxWorks breakpoint-handling module Joel Brobecker
2011-02-24 17:54 ` [PATCH 08/18] Add options to control Vxworks related settings Joel Brobecker
2011-02-24 17:55 ` [PATCH 10/18] "multi-tasks-mode" support Joel Brobecker
2011-02-24 17:56 ` [PATCH 11/18] Add partition support Joel Brobecker
2011-02-25 16:17   ` Tom Tromey
2011-02-24 17:56 ` [PATCH 07/18] remote-wtxapi: The WTX API abstraction layer Joel Brobecker
2011-02-24 19:44   ` Tom Tromey
2011-02-24 17:57 ` [PATCH 13/18] Add new "wtx" target Joel Brobecker
2011-02-25 16:15   ` Tom Tromey
2011-02-25 17:38     ` Joel Brobecker
2011-02-24 17:57 ` [PATCH 14/18] WTX-TCL support module Joel Brobecker
2011-02-25 15:59   ` Tom Tromey
2011-02-25 18:58     ` Joel Brobecker
2011-02-28 15:37       ` Tom Tromey
2011-02-24 17:57 ` [PATCH 12/18] remote-wtx-hw: register fetch/store support Joel Brobecker
2011-02-24 17:58 ` [PATCH 15/18] Add support for VxWorks 6 Joel Brobecker
2011-02-24 17:59 ` [PATCH 17/18] Configury and Makefile updates for VxWorks Joel Brobecker
2011-02-24 17:59 ` [PATCH 16/18] Add tdep files for x86 and powerpc Joel Brobecker
2011-02-24 18:58   ` Mark Kettenis
2011-02-25  8:29     ` Joel Brobecker
2011-02-24 18:04 ` [PATCH 18/18] document the new VxWorks port Joel Brobecker
2011-02-24 20:27   ` Eli Zaretskii
2011-02-25 11:12     ` Jerome Guitton
2011-02-25 11:27       ` Eli Zaretskii
2011-02-25 11:38         ` Jerome Guitton
2011-02-25 11:38           ` Joel Brobecker
2011-02-25 12:08             ` Eli Zaretskii
2011-02-25 13:26               ` Jerome Guitton
2011-02-25 11:44           ` Eli Zaretskii
2011-02-25 11:49             ` Joel Brobecker
2011-02-25 11:55               ` Jerome Guitton
2011-02-25 11:56                 ` Joel Brobecker
2011-02-25 12:01                   ` Pedro Alves
2011-02-25 14:21                     ` Joel Brobecker
2011-02-25 14:44                       ` Pedro Alves
2011-02-25 15:15                         ` Joel Brobecker
2011-02-25 12:05                   ` Jerome Guitton
2011-02-25 12:15                     ` Eli Zaretskii
2011-02-25 12:56                       ` Joel Brobecker
2011-02-25 13:20                         ` Eli Zaretskii
2011-02-25 14:11                           ` Jerome Guitton
2011-03-03 12:16     ` Joel Brobecker
2011-03-03 13:44       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1298569763-18784-2-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox