This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [patch] nto-procfs.c: Add to_xfer_partial

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
  Moreover, you are using an 'int' to store an 'unsigned int'...

  It would probably be better to use
  gdb_byte anint32[4];
  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?: [mailto:gdb-patches-
>] De la part de Aleksandar Ristovski
> Envoyé?: Thursday, June 11, 2009 10:31 PM
> À?:
> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]