Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 14/18] WTX-TCL support module
Date: Fri, 25 Feb 2011 15:59:00 -0000	[thread overview]
Message-ID: <m3mxlkceon.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1298569763-18784-15-git-send-email-brobecker@adacore.com> (Joel	Brobecker's message of "Thu, 24 Feb 2011 12:49:19 -0500")

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> For VxWorks 5.x and 653, we need to use the TCL extension in order to
Joel> access some of the information we are looking for (list of VxWorks
Joel> tasks running on the target, for instance).  This is only because
Joel> the WTX protocol does not provide access to this info.

Joel> +/* Includes from the VxWorks install.  */
Joel> +#define HOST
Joel> +#include "tcl.h"
Joel> +#if WTX_PROT_VERSION != 4
Joel> +#include "wtxtcl.h"
Joel> +#endif

I guess this explains why the new code isn't part of
--enable-targets=all.  I am somewhat concerned that this will lead to
bit-rot.  I always build using this option in an attempt to avoid
breaking things; but this code will not be included in that.

I don't really see a way around it, though, unless you want to
virtualize all the wtx calls.

I guess I want us to be clear that build breakage for this is expected.

Joel> +static int
Joel> +wtxtcl_eval_verbose (char *str)
Joel> +{
Joel> +  char *output;
Joel> +  const int success = wtxtcl_eval (str, &output);
Joel> +
Joel> +  if (success)
Joel> +    printf_filtered ("%s\n", output);
Joel> +  else
Joel> +    printf_filtered (_("TCL error: %s\n"), output);
Joel> +
Joel> +  return success;
Joel> +}
Joel> +
Joel> +/* Implement the "tcl" command.  */
Joel> +
Joel> +static void
Joel> +tcl_command (char *args, int from_tty)
Joel> +{
Joel> +  if (args == NULL)
Joel> +    return;
Joel> +
Joel> +  wtxtcl_eval_verbose (args);

Why not call error instead of just printing a message when a Tcl command
fails?

Joel> +  tcl_cmd = xstrprintf ("taskInfoGet 0x%x", task_id);
Joel> +  success = wtxtcl_eval (tcl_cmd, &task_info);

Nothing ever frees tcl_cmd.

Joel> +  /* Skip the first 8 tokens and go directly to the 9th, which contains
Joel> +     the PD ID.  */
Joel> +  for (j = 0; j < 8; j++)
Joel> +    task_info = skip_space_delimited_token (task_info);

This is the wrong way to parse a Tcl list.  It may work ok for your
purposes, if you know that the result can never include anything "weird".
But it is easy and safer to just use Tcl_SplitList.

Joel> +  /* Parse the result.  */
Joel> +
Joel> +  current_thread = skip_whitespace (tcl_output);
Joel> +  while (current_thread && *current_thread != '\0')
Joel> +    {
Joel> +      struct wtxapi_thread_info *new_thread
Joel> +        = xmalloc (sizeof (struct wtxapi_thread_info));
Joel> +
Joel> +      /* Get the thread id.  */
Joel> +      new_thread->id = strtoul (current_thread, NULL, 0);
Joel> +      current_thread = skip_space_delimited_token (current_thread);
Joel> +
Joel> +      /* Get the thread name.  */
Joel> +      current_thread = skip_whitespace (current_thread);
Joel> +      if (*current_thread == '{')
Joel> +        {
Joel> +          /* The thread name delimited by curly braces.  Find the
Joel> +             closing curly brace.  */
Joel> +          char *start = current_thread + 1;  /* skip the '{'...  */
Joel> +          char *end = skip_until_character (current_thread, '}');
Joel> +          char tmp = *end;

Likewise.

Joel> +  add_com ("tcl", class_obscure, tcl_command,
Joel> +           _("Evaluate the arguments with the TCL interpreter"));

I am not super fond of a top-level command named "tcl".

Tom


  reply	other threads:[~2011-02-25 15:33 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 ` [PATCH 01/18] Some ada-lang/ada-tasks routines needed by the VxWorks target Joel Brobecker
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: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:51 ` [PATCH 05/18] new struct bp_target_info target_private_data field Joel Brobecker
2011-02-24 17:54 ` [PATCH 08/18] Add options to control Vxworks related settings Joel Brobecker
2011-02-24 17:54 ` [PATCH 09/18] VxWorks breakpoint-handling module 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:55 ` [PATCH 10/18] "multi-tasks-mode" support Joel Brobecker
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:56 ` [PATCH 11/18] Add partition support Joel Brobecker
2011-02-25 16:17   ` Tom Tromey
2011-02-24 17:57 ` [PATCH 14/18] WTX-TCL support module Joel Brobecker
2011-02-25 15:59   ` Tom Tromey [this message]
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: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:58 ` [PATCH 15/18] Add support for VxWorks 6 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 17:59 ` [PATCH 17/18] Configury and Makefile updates for VxWorks 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=m3mxlkceon.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=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