Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Thiago Jung Bauermann'" <bauerman@br.ibm.com>
Cc: "'gdb-patches ml'" <gdb-patches@sourceware.org>
Subject: RE: [RFA] Add la_getstr member to language_defn
Date: Thu, 05 Feb 2009 16:01:00 -0000	[thread overview]
Message-ID: <000001c987ab$048df7a0$0da9e6e0$@u-strasbg.fr> (raw)
In-Reply-To: <1233836456.14735.69.camel@localhost.localdomain>


  Hi Thiago,

  I just wrote a pascal version of your c_get_string,
which basically calls c_get_string but also handles
Pascal string types specifically.

  The problem is that I found no reference to 
this la_get_string in the code yet, so that I am
unable to really check if my patch is correct.

  Is this in some submitted patch for python
or isn't it ready for submission yet?
Could you please send me a pointer to that patch?


Pierre Muller
Pascal language support maintainer for GDB


This is the function I wrote:


static void
pascal_get_string (struct value *value, gdb_byte **buffer, int *length,
              const char **charset)
{
  int err, width;
  unsigned int fetchlimit;
  struct type *type = check_typedef (value_type (value));
  struct type *element_type;
  int length_pos, length_size, string_pos;

  if (is_pascal_string_type (type, &length_pos, &length_size,
                             &string_pos, &width, NULL))
    {
      CORE_ADDR addr = value_as_address (value);
      ULONGEST string_length;
      *buffer = xmalloc (length_size);
      if (target_read_memory (addr + length_pos, *buffer, length_size)
          == length_size)
        {
          string_length = extract_unsigned_integer (*buffer, length_size);
          xfree (*buffer);
          *buffer = xmalloc (length_size * width);
          fetchlimit = string_length;
          err = read_string (addr + string_pos, string_length,
                             width, fetchlimit, buffer, length);
          *charset = target_charset ();
        }
      else
        err = 1;
      if (err)
        {
          xfree (*buffer);
          error (_("Error reading pascal string from inferior: %s"),
                 safe_strerror (err));
        }
      return;
    }
  else
    c_get_string (value, buffer, length, charset);
}


  reply	other threads:[~2009-02-05 16:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 13:24 Thiago Jung Bauermann
2008-11-24 13:32 ` Daniel Jacobowitz
2008-11-24 14:59   ` Thiago Jung Bauermann
2008-11-24 16:19     ` Daniel Jacobowitz
2008-11-24 20:22       ` Thiago Jung Bauermann
2008-11-25  2:16         ` Daniel Jacobowitz
2008-11-25  8:53           ` Thiago Jung Bauermann
2009-01-03  2:27             ` Thiago Jung Bauermann
2009-02-02 18:42               ` Tom Tromey
2009-02-03 12:51                 ` Thiago Jung Bauermann
2009-02-03 17:44                   ` Tom Tromey
2009-02-04 12:37                     ` Thiago Jung Bauermann
2009-02-04 19:19                       ` Tom Tromey
2009-02-04 22:26                         ` Thiago Jung Bauermann
2009-02-05  0:55                           ` Tom Tromey
2009-02-05 12:21                             ` Thiago Jung Bauermann
2009-02-05 16:01                               ` Pierre Muller [this message]
2009-02-05 16:30                                 ` Thiago Jung Bauermann
2009-02-05 16:46                                 ` Tom Tromey
2009-02-05 15:55                           ` Tom Tromey
2009-02-05 16:07                             ` Pierre Muller
2009-02-05 16:33                               ` Thiago Jung Bauermann
2009-02-05 16:46                                 ` Tom Tromey
2009-02-03  0:23               ` Joel Brobecker
2009-02-03 13:02                 ` Thiago Jung Bauermann
2009-02-03 17:01                   ` Joel Brobecker
2009-02-03 17:40                     ` Tom Tromey
2009-02-05 17:01                     ` Thiago Jung Bauermann
2009-02-05 23:51                       ` Joel Brobecker
2008-11-24 20:03 ` Tom Tromey
2008-11-24 21:19   ` Thiago Jung Bauermann
2008-11-25  0:55     ` Tom Tromey
2008-11-25 11:27       ` Thiago Jung Bauermann

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='000001c987ab$048df7a0$0da9e6e0$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=bauerman@br.ibm.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