* [RFA] gcore/linux-proc fix
@ 2003-09-24 18:10 Elena Zannoni
2003-09-24 22:40 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-09-24 18:10 UTC (permalink / raw)
To: gdb-patches
This patch fixes some problems with the gcore command on single
threaded programs. Before the patch, the core file did not report
anywhere the PID of the process:
CORE 144 PRSTATUS
SIGINFO: signo: 0, code = 0, errno = 0
signal: 0, pending: 00000000, holding: 00000000
pid: 0, ppid = 0, pgrp = 0, sid = 0
^^^^^^^^^
utime: 0.000000s, stime: 0.000000s
cutime: 0.000000s, cstime: 0.000000s
eax: fffffffc ebx: bfffc4a4 ecx: bfffc4a4 edx: b75d79f8
esi: bfffc5bc edi: bfffc53c ebp: bfffc648 esp: bfffc484
eip: b75ebc02 eflags: 00000246, original eax: 000000a2
cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
after the patch:
CORE 144 PRSTATUS
SIGINFO: signo: 0, code = 0, errno = 0
signal: 0, pending: 00000000, holding: 00000000
pid: 5846, ppid = 0, pgrp = 0, sid = 0
^^^^^^^^^^^^
utime: 0.000000s, stime: 0.000000s
cutime: 0.000000s, cstime: 0.000000s
eax: fffffffc ebx: bffff674 ecx: bffff674 edx: b75d79f8
esi: bffff78c edi: bffff70c ebp: bffff818 esp: bffff654
eip: b75ebc02 eflags: 00000246, original eax: 000000a2
cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
CORE 108 FPREGSET
LINUX 512 <unknown>: 1189489535
Note also that if the function to write the note section is called via
the iterator for multi-threaded programs
(i.e. linux_corefile_thread_callback),
registers_changed()/target_fetch_registers() are called, but if
invoked directly for the single-threaded case,
registers_changed()/target_fetch_registers() are not called.
So I added a wrapper to do that.
It all works fine with multi-threaded apps.
elena
2003-09-24 Elena Zannoni <ezannoni@redhat.com>
* linux-proc.c (linux_do_registers): New function.
(linux_make_note_section): Use linux_do_registers in case of
single threaded inferior programs.
Index: linux-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-proc.c,v
retrieving revision 1.15
diff -u -p -r1.15 linux-proc.c
--- linux-proc.c 19 Jun 2003 22:52:03 -0000 1.15
+++ linux-proc.c 24 Sep 2003 16:33:07 -0000
@@ -233,6 +234,26 @@ linux_corefile_thread_callback (struct l
return 0;
}
+/* Function: linux_do_registers
+ *
+ * Records the register state for the corefile note section.
+ */
+
+static char *
+linux_do_registers (bfd *obfd, ptid_t ptid,
+ char *note_data, int *note_size)
+{
+ registers_changed ();
+ target_fetch_registers (-1); /* FIXME should not be necessary;
+ fill_gregset should do it automatically. */
+ return linux_do_thread_registers (obfd,
+ ptid_build (ptid_get_pid (inferior_ptid),
+ ptid_get_pid (inferior_ptid),
+ 0),
+ note_data, note_size);
+ return note_data;
+}
+
/* Function: linux_make_note_section
*
* Fills the "to_make_corefile_note" target vector.
@@ -275,8 +296,8 @@ linux_make_note_section (bfd *obfd, int
{
/* iterate_over_threads didn't come up with any threads;
just use inferior_ptid. */
- note_data = linux_do_thread_registers (obfd, inferior_ptid,
- note_data, note_size);
+ note_data = linux_do_registers (obfd, inferior_ptid,
+ note_data, note_size);
}
else
{
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] gcore/linux-proc fix
2003-09-24 18:10 [RFA] gcore/linux-proc fix Elena Zannoni
@ 2003-09-24 22:40 ` Daniel Jacobowitz
2003-09-25 19:45 ` Elena Zannoni
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-09-24 22:40 UTC (permalink / raw)
To: gdb-patches
On Wed, Sep 24, 2003 at 12:52:20PM -0400, Elena Zannoni wrote:
>
> This patch fixes some problems with the gcore command on single
> threaded programs. Before the patch, the core file did not report
> anywhere the PID of the process:
>
>
> CORE 144 PRSTATUS
> SIGINFO: signo: 0, code = 0, errno = 0
> signal: 0, pending: 00000000, holding: 00000000
> pid: 0, ppid = 0, pgrp = 0, sid = 0
> ^^^^^^^^^
>
>
> utime: 0.000000s, stime: 0.000000s
> cutime: 0.000000s, cstime: 0.000000s
> eax: fffffffc ebx: bfffc4a4 ecx: bfffc4a4 edx: b75d79f8
> esi: bfffc5bc edi: bfffc53c ebp: bfffc648 esp: bfffc484
> eip: b75ebc02 eflags: 00000246, original eax: 000000a2
> cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
>
>
>
>
> after the patch:
>
>
> CORE 144 PRSTATUS
> SIGINFO: signo: 0, code = 0, errno = 0
> signal: 0, pending: 00000000, holding: 00000000
> pid: 5846, ppid = 0, pgrp = 0, sid = 0
> ^^^^^^^^^^^^
>
> utime: 0.000000s, stime: 0.000000s
> cutime: 0.000000s, cstime: 0.000000s
> eax: fffffffc ebx: bffff674 ecx: bffff674 edx: b75d79f8
> esi: bffff78c edi: bffff70c ebp: bffff818 esp: bffff654
> eip: b75ebc02 eflags: 00000246, original eax: 000000a2
> cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
>
> CORE 108 FPREGSET
> LINUX 512 <unknown>: 1189489535
>
>
>
> Note also that if the function to write the note section is called via
> the iterator for multi-threaded programs
> (i.e. linux_corefile_thread_callback),
> registers_changed()/target_fetch_registers() are called, but if
> invoked directly for the single-threaded case,
> registers_changed()/target_fetch_registers() are not called.
> So I added a wrapper to do that.
>
> It all works fine with multi-threaded apps.
Looks good to me. I've been using a similar hack to call
target_fetch_registers, too.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] gcore/linux-proc fix
2003-09-24 22:40 ` Daniel Jacobowitz
@ 2003-09-25 19:45 ` Elena Zannoni
2003-09-29 21:18 ` Michael Snyder
0 siblings, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-09-25 19:45 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: msnyder, gdb-patches
Daniel Jacobowitz writes:
> On Wed, Sep 24, 2003 at 12:52:20PM -0400, Elena Zannoni wrote:
> >
> > This patch fixes some problems with the gcore command on single
> > threaded programs. Before the patch, the core file did not report
> > anywhere the PID of the process:
> >
> >
> > CORE 144 PRSTATUS
> > SIGINFO: signo: 0, code = 0, errno = 0
> > signal: 0, pending: 00000000, holding: 00000000
> > pid: 0, ppid = 0, pgrp = 0, sid = 0
> > ^^^^^^^^^
> >
> >
> > utime: 0.000000s, stime: 0.000000s
> > cutime: 0.000000s, cstime: 0.000000s
> > eax: fffffffc ebx: bfffc4a4 ecx: bfffc4a4 edx: b75d79f8
> > esi: bfffc5bc edi: bfffc53c ebp: bfffc648 esp: bfffc484
> > eip: b75ebc02 eflags: 00000246, original eax: 000000a2
> > cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
> >
> >
> >
> >
> > after the patch:
> >
> >
> > CORE 144 PRSTATUS
> > SIGINFO: signo: 0, code = 0, errno = 0
> > signal: 0, pending: 00000000, holding: 00000000
> > pid: 5846, ppid = 0, pgrp = 0, sid = 0
> > ^^^^^^^^^^^^
> >
> > utime: 0.000000s, stime: 0.000000s
> > cutime: 0.000000s, cstime: 0.000000s
> > eax: fffffffc ebx: bffff674 ecx: bffff674 edx: b75d79f8
> > esi: bffff78c edi: bffff70c ebp: bffff818 esp: bffff654
> > eip: b75ebc02 eflags: 00000246, original eax: 000000a2
> > cs: 0023 ds: 002b es: 002b fs: 0000 gs: 0033 ss: 002b
> >
> > CORE 108 FPREGSET
> > LINUX 512 <unknown>: 1189489535
> >
> >
> >
> > Note also that if the function to write the note section is called via
> > the iterator for multi-threaded programs
> > (i.e. linux_corefile_thread_callback),
> > registers_changed()/target_fetch_registers() are called, but if
> > invoked directly for the single-threaded case,
> > registers_changed()/target_fetch_registers() are not called.
> > So I added a wrapper to do that.
> >
> > It all works fine with multi-threaded apps.
>
> Looks good to me. I've been using a similar hack to call
> target_fetch_registers, too.
Cool, I'll wait to see if Michael has any comments.
elena
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] gcore/linux-proc fix
2003-09-25 19:45 ` Elena Zannoni
@ 2003-09-29 21:18 ` Michael Snyder
2003-10-01 20:37 ` Elena Zannoni
0 siblings, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2003-09-29 21:18 UTC (permalink / raw)
To: Elena Zannoni; +Cc: Daniel Jacobowitz, gdb-patches
Elena Zannoni wrote:
> Cool, I'll wait to see if Michael has any comments.
I like it, please apply.
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] gcore/linux-proc fix
2003-09-29 21:18 ` Michael Snyder
@ 2003-10-01 20:37 ` Elena Zannoni
0 siblings, 0 replies; 5+ messages in thread
From: Elena Zannoni @ 2003-10-01 20:37 UTC (permalink / raw)
To: Michael Snyder; +Cc: Elena Zannoni, Daniel Jacobowitz, gdb-patches
Michael Snyder writes:
> Elena Zannoni wrote:
>
> > Cool, I'll wait to see if Michael has any comments.
>
> I like it, please apply.
>
> Michael
Done
elena
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-10-01 20:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-24 18:10 [RFA] gcore/linux-proc fix Elena Zannoni
2003-09-24 22:40 ` Daniel Jacobowitz
2003-09-25 19:45 ` Elena Zannoni
2003-09-29 21:18 ` Michael Snyder
2003-10-01 20:37 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox