This is the mail archive of the gdb-patches@sourceware.org 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: Post mortem debugging for Windows CE


On Wed, 2009-05-06 at 21:48 +0100, Pedro Alves wrote:
> A few suggestions:
> 
>  - Please forgive me if you know this already.
>    Your minidump bfd code should work on all hosts, 64-bit, 32-bit,
>    big endian or little endian.  This means that code like:
[..]
>    ... is unacceptable.  You need to use the bfd_get_32 and friends
>    to parse the data on the file.

I'll start doing all that. I didn't know about avoiding structs so
this'll be some work.

Should they be avoided completely ? I wrote code like the snippet below.
Should the sizeof (CEDUMP_THREAD_CALL_STACK_LIST) be replaced ? Should
the struct definitions be gone completely, or still be there in
comment ?

Also this'll work for CE based minidumps now, not the ones from desktop
Windows. This may be as simple as getting the code to handle not only
the 
        ceStreamThreadCallStackList = 0x8007
but also the desktop value. But life is usually not that simple.

	Danny



  rva = minidump_core_locate_stream(abfd, ceStreamThreadCallStackList);
  if (bfd_seek (abfd, (file_ptr) rva, SEEK_SET) != 0)
    return;
  nread = bfd_bread (&tcsl, (bfd_size_type) sizeof
(CEDUMP_THREAD_CALL_STACK_LIST), abfd);
  if (nread != sizeof (CEDUMP_THREAD_CALL_STACK_LIST))
    {
      if (bfd_get_error () != bfd_error_system_call)
        bfd_set_error (bfd_error_wrong_format);
      return;
    }

  /*
   * Need to read all the CEDUMP_THREAD_CALL_STACK entries,
   * they're just after the CEDUMP_THREAD_CALL_STACK_LIST.
   * The CEDUMP_THREAD_CALL_STACK_FRAME fields are in potentially other
places though.
   * So allocate space for enough CEDUMP_THREAD_CALL_STACK_LIST entries.
   */
  sz = tcsl.NumberOfEntries * sizeof(CEDUMP_THREAD_CALL_STACK);
  tcs = bfd_malloc(sz);
  nread = bfd_bread (tcs, (bfd_size_type) sz, abfd);
  if (nread != sz)
    {
      if (bfd_get_error () != bfd_error_system_call)
        bfd_set_error (bfd_error_wrong_format);
      return;
    }




-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info


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