This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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] |
n Mon, 21 Jan 2002, Kevin Buettner wrote: > Takis, > > I looked your patch over and it looks pretty good except that it's > reversed. (When you did the diff, you did ``diff -c new old'' rather > than ``diff -c old new''.) Could you please resend your patch in > the non-reversed form. It'll make it easier to review. > > Oh... also, could you include ChangeLog entries this time? > > Thanks, > > Kevin > > P.S. I'm not the maintainer of any of the files in question, so > someone else will need to approve Takis' changes. > Hi Kevin, Attached is patch to make multithreaded corefile work again with gdb. Do: gzip -d < GDB51.diff.gz | patch -p0 -E to apply it in a clean gdb-5.1 source tree. Regards, Takis PS: Below is also the patch in text format. But try using the attaced gziped one. ============================================================= *** gdb-5.1/gdb/corelow.c.ORIG Tue Jan 22 21:58:02 2002 --- gdb-5.1/gdb/corelow.c Tue Jan 22 21:45:22 2002 *************** *** 234,254 **** static void add_to_thread_list (bfd *abfd, asection *asect, PTR reg_sect_arg) { ! int thread_id; asection *reg_sect = (asection *) reg_sect_arg; if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0) return; ! thread_id = atoi (bfd_section_name (abfd, asect) + 5); ! ! add_thread (pid_to_ptid (thread_id)); /* Warning, Will Robinson, looking at BFD private data! */ if (reg_sect != NULL && asect->filepos == reg_sect->filepos) /* Did we find .reg? */ ! inferior_ptid = pid_to_ptid (thread_id); /* Yes, make it current */ } /* This routine opens and sets up the core file bfd. */ --- 234,271 ---- static void add_to_thread_list (bfd *abfd, asection *asect, PTR reg_sect_arg) { ! ! int p_id, count; ! long t_id; asection *reg_sect = (asection *) reg_sect_arg; if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0) return; ! count = sscanf (bfd_section_name (abfd, asect), ".reg/%d+%ld", ! &p_id, &t_id); ! #if defined(DEBUG) ! if ( count == 2 ) ! warning ("add_to_thread_list: adding thread PID=%d+LWPID=%ld \n", p_id, t_id); ! else if ( count == 1) ! warning ("add_to_thread_list: PID=%d but LWPID=? I could not retrieve the lwpid!!!\n" ! , p_id); ! #endif /* DEBUG */ ! ! if ( count == 2 ) ! add_thread ( ptid_build (p_id, t_id, 0) ); ! else ! { ! /* This should not happen! */ ! warning ("add_to_thread_list: Helloooooo! something is badly wrong!\n"); ! return; ! } /* Warning, Will Robinson, looking at BFD private data! */ if (reg_sect != NULL && asect->filepos == reg_sect->filepos) /* Did we find .reg? */ ! inferior_ptid = ptid_build (p_id, t_id, 0); /* Yes, make it current */ } /* This routine opens and sets up the core file bfd. */ *************** *** 407,413 **** char *contents; if (PIDGET (inferior_ptid)) ! sprintf (section_name, "%s/%d", name, PIDGET (inferior_ptid)); else strcpy (section_name, name); --- 424,431 ---- char *contents; if (PIDGET (inferior_ptid)) ! sprintf (section_name, "%s/%d+%ld", name, ! PIDGET(inferior_ptid), TIDGET(inferior_ptid) ); else strcpy (section_name, name); *** gdb-5.1/bfd/elf.c.ORIG Tue Jan 22 21:46:54 2002 --- gdb-5.1/bfd/elf.c Tue Jan 22 21:33:59 2002 *************** *** 5349,5354 **** --- 5349,5365 ---- + (elf_tdata (abfd)->core_pid)); } + static char * + elfcore_make_ptid_str (abfd) + bfd *abfd; + { + static char ptid_buf[40]; + + sprintf (ptid_buf, "%d+%ld", (elf_tdata (abfd)->core_pid), + (elf_tdata (abfd)->core_lwpid) ); + return ptid_buf; + } + /* If there isn't a section called NAME, make one, using data from SECT. Note, this function will generate a reference to NAME, so you shouldn't deallocate or *************** *** 5380,5387 **** actually creates up to two pseudosections: - For the single-threaded case, a section named NAME, unless such a section already exists. ! - For the multi-threaded case, a section named "NAME/PID", where ! PID is elfcore_make_pid (abfd). Both pseudosections have identical contents. */ boolean _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) --- 5391,5398 ---- actually creates up to two pseudosections: - For the single-threaded case, a section named NAME, unless such a section already exists. ! - For the multi-threaded case, a section named "NAME/PID+LWPID", where ! PID+LWIPD is prepared by elfcore_make_ptid_str (abfd). Both pseudosections have identical contents. */ boolean _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) *************** *** 5396,5402 **** /* Build the section name. */ ! sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd)); threaded_name = bfd_alloc (abfd, strlen (buf) + 1); if (threaded_name == NULL) return false; --- 5407,5413 ---- /* Build the section name. */ ! sprintf (buf, "%s/%s", name, elfcore_make_ptid_str (abfd)); threaded_name = bfd_alloc (abfd, strlen (buf) + 1); if (threaded_name == NULL) return false; *************** *** 5688,5694 **** /* Make a ".reg/999" section. */ ! sprintf (buf, ".reg/%d", elfcore_make_pid (abfd)); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return false; --- 5699,5705 ---- /* Make a ".reg/999" section. */ ! sprintf (buf, ".reg/%s", elfcore_make_ptid_str (abfd)); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return false; *************** *** 5717,5723 **** /* Make a ".reg2/999" section */ ! sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd)); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return false; --- 5728,5734 ---- /* Make a ".reg2/999" section */ ! sprintf (buf, ".reg2/%s", elfcore_make_ptid_str (abfd)); name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return false; ===============================================================
Attachment:
GDB51.diff.gz
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |