Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Aleksandar Ristovski'" <aristovski@qnx.com>,
	        <gdb-patches@sources.redhat.com>
Subject: RE: [patch] nto-procfs.c: Add to_xfer_partial
Date: Thu, 11 Jun 2009 21:36:00 -0000	[thread overview]
Message-ID: <002201c9eadc$a58129e0$f0837da0$@u-strasbg.fr> (raw)
In-Reply-To: <h0rpib$7te$1@ger.gmane.org>

Hi Aleksandar,

  I can't comment on the correctness of your code
to nto_read_auxv_from_initial_stack,
but I think that you should avoid using 'int'
and assume that 'int' is 32-bit long in a tdep file.

+  int anint32;
+  LONGEST len_read = 0;
+  gdb_byte *panint32 = (gdb_byte*)&anint32;
+  gdb_byte *buff;
+
+  /* Skip over argc, argv and envp... (see comment in ldd.c)  */
+  if (target_read_memory (initial_stack + data_ofs, panint32, 4) != 0)
+    return 0;
+
+  anint32 = extract_unsigned_integer (panint32, sizeof (anint32));

  if sizeof(int) is not 4 on the host machine, your code will not work
correctly.
  Moreover, you are using an 'int' to store an 'unsigned int'...

  It would probably be better to use
  gdb_byte anint32[4];
and
  ULONGEST uint32value
  uint32value = extract_unsigned_integer (&anint32, sizeof (anint32));

Please remember that tdep files
should be compilable by systems having different
endianess, but also pointer and/or standard integer sizes.



Pierre Muller
Pascal language support maintainer for GDB


> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Aleksandar Ristovski
> Envoyé : Thursday, June 11, 2009 10:31 PM
> À : gdb-patches@sources.redhat.com
> Objet : [patch] nto-procfs.c: Add to_xfer_partial
> 
> Hello,
> 
> This adds to_xfer_partial (auxv) capability to nto-procfs.
> 
> Thanks,
> 
> --
> Aleksandar Ristovski
> QNX Software Systems
> 
> 
> ChangeLog:
> * nto-procfs.c (procfs_xfer_partial): New function.
> (init_procfs_ops): Register to_xfer_partial.
> * nto-tdep.h (nto_read_auxv_from_initial_stack): Declare.
> * nto-tdep.c (nto_read_auxv_from_initial_stack): Define.



  reply	other threads:[~2009-06-11 21:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11 20:31 Aleksandar Ristovski
2009-06-11 21:36 ` Pierre Muller [this message]
2009-06-12  2:25   ` Aleksandar Ristovski
2009-06-12  6:55     ` Pierre Muller
2009-06-18 15:16       ` Aleksandar Ristovski
2009-07-07 16:23         ` Aleksandar Ristovski
2009-07-21 15:45           ` Aleksandar Ristovski
2009-07-24 14:16           ` Pedro Alves
2009-07-27 20:17             ` Aleksandar Ristovski
2009-07-28 12:01               ` Pedro Alves
2009-07-28 22:17                 ` Aleksandar Ristovski
2009-08-24 11:34                   ` Pedro Alves

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='002201c9eadc$a58129e0$f0837da0$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=aristovski@qnx.com \
    --cc=gdb-patches@sources.redhat.com \
    /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