* [rfa] Printf debugging output in lin-lwp.c
@ 2001-04-30 11:34 Michael Snyder
2001-04-30 12:06 ` Mark Kettenis
2001-04-30 18:14 ` Andrew Cagney
0 siblings, 2 replies; 4+ messages in thread
From: Michael Snyder @ 2001-04-30 11:34 UTC (permalink / raw)
To: gdb-patches; +Cc: cagney, kevinb, kettenis
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7829 bytes --]
Mark, how about this?
2001-04-30 Michael Snyder <msnyder@redhat.com>
* thread-db.c: Revert 2001-04-26 change for debugging output.
* lin-lwp.c: Ditto.
* lin-lwp.c: Add set/show debug lin-lwp command. Use this
command to turn extra debugging output on / off.
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 lin-lwp.c
*** lin-lwp.c 2001/04/30 18:21:17 1.11
--- lin-lwp.c 2001/04/30 18:26:45
***************
*** 30,41 ****
#include "inferior.h"
#include "target.h"
#include "regcache.h"
! #define DEBUG 1
!
! #if DEBUG
extern const char *strsignal (int sig);
- #endif
/* On Linux there are no real LWP's. The closest thing to LWP's are
processes sharing the same VM space. A multi-threaded process is
--- 30,39 ----
#include "inferior.h"
#include "target.h"
#include "regcache.h"
+ #include "gdbcmd.h"
! static int debug_lin_lwp;
extern const char *strsignal (int sig);
/* On Linux there are no real LWP's. The closest thing to LWP's are
processes sharing the same VM space. A multi-threaded process is
*************** stop_wait_callback (struct lwp_info *lp,
*** 521,529 ****
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->pid));
}
! #if DEBUG
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
! #endif
delete_lwp (lp->pid);
return 0;
}
--- 519,527 ----
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->pid));
}
! if (debug_lin_lwp)
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
!
delete_lwp (lp->pid);
return 0;
}
*************** stop_wait_callback (struct lwp_info *lp,
*** 549,569 ****
If we do not do this, then we run the risk that the
user will delete or disable the breakpoint, but the
thread will have already tripped on it. */
! #if DEBUG
! printf ("Tripped breakpoint at %lx in LWP %d"
! " while waiting for SIGSTOP.\n",
! (long) read_pc_pid (lp->pid), pid);
! #endif
/* Set the PC to before the trap. */
if (DECR_PC_AFTER_BREAK)
write_pc_pid (read_pc_pid (pid) - DECR_PC_AFTER_BREAK, pid);
}
else
{
! #if DEBUG
! printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
! strsignal (WSTOPSIG (status)), pid);
! #endif
/* The thread was stopped with a signal other than
SIGSTOP, and didn't accidentiliy trip a breakpoint.
Record the wait status. */
--- 547,568 ----
If we do not do this, then we run the risk that the
user will delete or disable the breakpoint, but the
thread will have already tripped on it. */
!
! if (debug_lin_lwp)
! printf ("Tripped breakpoint at %lx in LWP %d"
! " while waiting for SIGSTOP.\n",
! (long) read_pc_pid (lp->pid), pid);
!
/* Set the PC to before the trap. */
if (DECR_PC_AFTER_BREAK)
write_pc_pid (read_pc_pid (pid) - DECR_PC_AFTER_BREAK, pid);
}
else
{
! if (debug_lin_lwp)
! printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
! strsignal (WSTOPSIG (status)), pid);
!
/* The thread was stopped with a signal other than
SIGSTOP, and didn't accidentiliy trip a breakpoint.
Record the wait status. */
*************** lin_lwp_wait (int pid, struct target_wai
*** 620,629 ****
lp = iterate_over_lwps (status_callback, NULL);
if (lp)
{
! #if DEBUG
! printf ("Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
! #endif
status = lp->status;
lp->status = 0;
}
--- 619,628 ----
lp = iterate_over_lwps (status_callback, NULL);
if (lp)
{
! if (debug_lin_lwp)
! printf ("Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
!
status = lp->status;
lp->status = 0;
}
*************** lin_lwp_wait (int pid, struct target_wai
*** 635,653 ****
}
else if (is_lwp (pid))
{
! #if DEBUG
! printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
! #endif
/* We have a specific LWP to check. */
lp = find_lwp_pid (GET_LWP (pid));
gdb_assert (lp);
status = lp->status;
lp->status = 0;
! #if DEBUG
! if (status)
printf ("Using pending wait status for LWP %d.\n",
GET_LWP (lp->pid));
- #endif
/* If we have to wait, take into account whether PID is a cloned
process or not. And we have to convert it to something that
--- 634,652 ----
}
else if (is_lwp (pid))
{
! if (debug_lin_lwp)
! printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
!
/* We have a specific LWP to check. */
lp = find_lwp_pid (GET_LWP (pid));
gdb_assert (lp);
status = lp->status;
lp->status = 0;
!
! if (debug_lin_lwp)
! if (status)
printf ("Using pending wait status for LWP %d.\n",
GET_LWP (lp->pid));
/* If we have to wait, take into account whether PID is a cloned
process or not. And we have to convert it to something that
*************** lin_lwp_wait (int pid, struct target_wai
*** 725,733 ****
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->pid));
}
! #if DEBUG
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
! #endif
delete_lwp (lp->pid);
/* Make sure there is at least one thread running. */
--- 724,732 ----
printf_unfiltered ("[%s exited]\n",
target_pid_to_str (lp->pid));
}
! if (debug_lin_lwp)
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
!
delete_lwp (lp->pid);
/* Make sure there is at least one thread running. */
*************** lin_lwp_wait (int pid, struct target_wai
*** 743,752 ****
if (lp->signalled && WIFSTOPPED (status)
&& WSTOPSIG (status) == SIGSTOP)
{
! #if DEBUG
! printf ("Delayed SIGSTOP caught for %s.\n",
! target_pid_to_str (lp->pid));
! #endif
/* This is a delayed SIGSTOP. */
lp->signalled = 0;
--- 742,751 ----
if (lp->signalled && WIFSTOPPED (status)
&& WSTOPSIG (status) == SIGSTOP)
{
! if (debug_lin_lwp)
! printf ("Delayed SIGSTOP caught for %s.\n",
! target_pid_to_str (lp->pid));
!
/* This is a delayed SIGSTOP. */
lp->signalled = 0;
*************** _initialize_lin_lwp (void)
*** 1040,1045 ****
--- 1039,1051 ----
sigdelset (&suspend_mask, SIGCHLD);
sigemptyset (&blocked_mask);
+
+ add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
+ (char *) &debug_lin_lwp,
+ "Set debugging of linux lwp module.\n\
+ Enables printf debugging output.\n",
+ &setdebuglist),
+ &showdebuglist);
}
\f
From beambro@marioworld.com Mon Apr 30 11:34:00 2001
From: "ªü±l"<beambro@marioworld.com>
To: "" <gdb-patches@sources.redhat.com>
Subject: ¾Ã©f³Q....XXX...
Date: Mon, 30 Apr 2001 11:34:00 -0000
Message-id: <9a6fba934031bc7730ae85c4171accde@NO-ID-FOUND.mhonarc.org>
X-SW-Source: 2001-04/msg00282.html
Content-length: 353
ÃsÂô,
¤µ¦~¯uªº¤£¦n¹L,§Ã¤w¸g´«¤FNÂäu§@..
§@«á¤½¥q¤SÂó¬¤F...³o¤@®a¤½¥qÃZ¦nª±ªº..
§Ã¦b¬ü°ê¦³¸òElena¤@°_ª±¹L....Â¥xÃW¤]¯u¥ý¶i..
§A¦n¦n¬Ã¬Ã..§ÃÂä]Â¥iÂ¥H¶}¤@¶¡......
--------«ö¤U±ªº³s
µ²-------------
©P¬ü¶³.......
p.s. ¬P´Ã¤» Friday's ¨£Â±!!
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [rfa] Printf debugging output in lin-lwp.c
2001-04-30 11:34 [rfa] Printf debugging output in lin-lwp.c Michael Snyder
@ 2001-04-30 12:06 ` Mark Kettenis
2001-04-30 18:14 ` Andrew Cagney
1 sibling, 0 replies; 4+ messages in thread
From: Mark Kettenis @ 2001-04-30 12:06 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches, cagney, kevinb
Date: Mon, 30 Apr 2001 11:29:42 -0700
From: Michael Snyder <msnyder@cygnus.com>
Mark, how about this?
Looks good to me (except for the formatting of the ChangeLog entry :-)).
[In reply to your other mail]
Well, I figured we would from time to time need some similar
printf/debug code in thread-db too. As for it not being
linux-specific, that was the original hope, but I don't
really imagine it happening anytime soon.
I think a seperate switch for debug code in thread-db would be
appropriate.
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [rfa] Printf debugging output in lin-lwp.c
2001-04-30 11:34 [rfa] Printf debugging output in lin-lwp.c Michael Snyder
2001-04-30 12:06 ` Mark Kettenis
@ 2001-04-30 18:14 ` Andrew Cagney
2001-05-01 13:38 ` [patch] change printf to fprintf_unfiltered Michael Snyder
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-04-30 18:14 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, cagney, kevinb, kettenis
Michael Snyder wrote:
> ! if (debug_lin_lwp)
> ! printf ("Delayed SIGSTOP caught for %s.\n",
> ! target_pid_to_str (lp->pid));
> !
FYI, once this is in, someone should go through and change the
printf()'s to:
fprintf_unfiltered (gdb_stdlog, ...);
> +
> + add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
> + (char *) &debug_lin_lwp,
> + "Set debugging of linux lwp module.\n\
> + Enables printf debugging output.\n",
> + &setdebuglist),
> + &showdebuglist);
Yep, thanks!
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread* [patch] change printf to fprintf_unfiltered.
2001-04-30 18:14 ` Andrew Cagney
@ 2001-05-01 13:38 ` Michael Snyder
0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2001-05-01 13:38 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches, kettenis
Andrew Cagney wrote:
>
> Michael Snyder wrote:
>
> > ! if (debug_lin_lwp)
> > ! printf ("Delayed SIGSTOP caught for %s.\n",
> > ! target_pid_to_str (lp->pid));
> > !
>
> FYI, once this is in, someone should go through and change the
> printf()'s to:
OK:
2001-05-01 Michael Snyder <msnyder@redhat.com>
* lin-lwp.c: Change printf to fprintf_unfiltered.
Index: lin-lwp.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-lwp.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 lin-lwp.c
*** lin-lwp.c 2001/04/30 20:25:07 1.12
--- lin-lwp.c 2001/05/01 20:36:46
*************** stop_wait_callback (struct lwp_info *lp,
*** 520,526 ****
target_pid_to_str (lp->pid));
}
if (debug_lin_lwp)
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
delete_lwp (lp->pid);
return 0;
--- 520,527 ----
target_pid_to_str (lp->pid));
}
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "%s exited.\n", target_pid_to_str (lp->pid));
delete_lwp (lp->pid);
return 0;
*************** stop_wait_callback (struct lwp_info *lp,
*** 549,557 ****
thread will have already tripped on it. */
if (debug_lin_lwp)
! printf ("Tripped breakpoint at %lx in LWP %d"
! " while waiting for SIGSTOP.\n",
! (long) read_pc_pid (lp->pid), pid);
/* Set the PC to before the trap. */
if (DECR_PC_AFTER_BREAK)
--- 550,559 ----
thread will have already tripped on it. */
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "Tripped breakpoint at %lx in LWP %d"
! " while waiting for SIGSTOP.\n",
! (long) read_pc_pid (lp->pid), pid);
/* Set the PC to before the trap. */
if (DECR_PC_AFTER_BREAK)
*************** stop_wait_callback (struct lwp_info *lp,
*** 560,567 ****
else
{
if (debug_lin_lwp)
! printf ("Received %s in LWP %d while waiting for SIGSTOP.\n",
! strsignal (WSTOPSIG (status)), pid);
/* The thread was stopped with a signal other than
SIGSTOP, and didn't accidentiliy trip a breakpoint.
--- 562,570 ----
else
{
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "Received %s in LWP %d while waiting for SIGSTOP.\n",
! strsignal (WSTOPSIG (status)), pid);
/* The thread was stopped with a signal other than
SIGSTOP, and didn't accidentiliy trip a breakpoint.
*************** lin_lwp_wait (int pid, struct target_wai
*** 620,627 ****
if (lp)
{
if (debug_lin_lwp)
! printf ("Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
status = lp->status;
lp->status = 0;
--- 623,631 ----
if (lp)
{
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
status = lp->status;
lp->status = 0;
*************** lin_lwp_wait (int pid, struct target_wai
*** 635,641 ****
else if (is_lwp (pid))
{
if (debug_lin_lwp)
! printf ("Waiting for specific LWP %d.\n", GET_LWP (pid));
/* We have a specific LWP to check. */
lp = find_lwp_pid (GET_LWP (pid));
--- 639,646 ----
else if (is_lwp (pid))
{
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "Waiting for specific LWP %d.\n", GET_LWP (pid));
/* We have a specific LWP to check. */
lp = find_lwp_pid (GET_LWP (pid));
*************** lin_lwp_wait (int pid, struct target_wai
*** 645,652 ****
if (debug_lin_lwp)
if (status)
! printf ("Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
/* If we have to wait, take into account whether PID is a cloned
process or not. And we have to convert it to something that
--- 650,658 ----
if (debug_lin_lwp)
if (status)
! fprintf_unfiltered (gdb_stdlog,
! "Using pending wait status for LWP %d.\n",
! GET_LWP (lp->pid));
/* If we have to wait, take into account whether PID is a cloned
process or not. And we have to convert it to something that
*************** lin_lwp_wait (int pid, struct target_wai
*** 725,731 ****
target_pid_to_str (lp->pid));
}
if (debug_lin_lwp)
! printf ("%s exited.\n", target_pid_to_str (lp->pid));
delete_lwp (lp->pid);
--- 731,739 ----
target_pid_to_str (lp->pid));
}
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "%s exited.\n",
! target_pid_to_str (lp->pid));
delete_lwp (lp->pid);
*************** lin_lwp_wait (int pid, struct target_wai
*** 743,750 ****
&& WSTOPSIG (status) == SIGSTOP)
{
if (debug_lin_lwp)
! printf ("Delayed SIGSTOP caught for %s.\n",
! target_pid_to_str (lp->pid));
/* This is a delayed SIGSTOP. */
lp->signalled = 0;
--- 751,759 ----
&& WSTOPSIG (status) == SIGSTOP)
{
if (debug_lin_lwp)
! fprintf_unfiltered (gdb_stdlog,
! "Delayed SIGSTOP caught for %s.\n",
! target_pid_to_str (lp->pid));
/* This is a delayed SIGSTOP. */
lp->signalled = 0;
From ezannoni@cygnus.com Tue May 01 20:17:00 2001
From: Elena Zannoni <ezannoni@cygnus.com>
To: Fernando Nasser <fnasser@redhat.com>
Cc: Elena Zannoni <ezannoni@cygnus.com>, gdb-patches@sources.redhat.com, hilfingr@otisco.mckusick.com
Subject: Re: RFA: [symfile.c} Fix to symbol_file_add()
Date: Tue, 01 May 2001 20:17:00 -0000
Message-id: <15087.31793.429533.289522@kwikemart.cygnus.com>
References: <3AED8391.C6B9A456@redhat.com> <15085.43538.55216.581538@kwikemart.cygnus.com> <3AEDF6A3.440D0C62@redhat.com> <15086.11696.278572.217415@kwikemart.cygnus.com> <3AEEB0E2.3232D2DE@redhat.com>
X-SW-Source: 2001-05/msg00008.html
Content-length: 2188
Fernando Nasser writes:
> Elena Zannoni wrote:
> >
> > > However, the bit:
> > > > > + /* Getting new symbols may change our opinion about
> > > > > + what is frameless. */
> > > > > + reinit_frame_cache ();
> > >
> > > should _always_ be done, whenever we load new symbols.
> > >
> >
> > I need to understand better what happens with shared libraries.
> > SOLIB_ADD ends up calling this. I see it used in the attach command
> > and in this case a reinit_frame_cache is OK, so is for the case in
> > sol-thread.c but what about the other calls?
> >
>
> The comment "Getting new symbols may change our opinion about what is
> frameless." basically answers your question. GDB is much more reliable
> at figuring out where the prologue ends when symbols are available. If
> you are stopped inside a function (in a shared library) and you did not
> had the symbols when you created the frame cache, you did a less job
> than you could have done if you had symbols.
>
(Gee, talk about cloning a comment throughout gdb!)
Yes, I agree with that. I was just thinking about a different case in
which the user may have manually loaded the shlibs ahead of time,
before the inferior calls any of the functions in the shlibs. But I
see that it is already called most, if not all, of the times.
> That is why the frame cache is always reset, so the frames can be
> reconstructed with mode information and, thus, more precisely.
>
Anyway, I think we could both be right, so I don't mind if you add the
call to the symbol_file_add function. I assume you would have to
adjust other code in shlib related files as well. Some of the
solib_add funtions are making sure that reinit_frame_cache is called
only once after loading all the shared libs. Now it will be done once
per shlib. I don't know what the overhead will be. Maybe shlib
maintainers can speak up once the new patch is posted.
Thanks for doing this, it turned out to be more work than the initial
patch was.
Elena
> --
> Fernando Nasser
> Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario M4P 2C9
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-05-01 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-30 11:34 [rfa] Printf debugging output in lin-lwp.c Michael Snyder
2001-04-30 12:06 ` Mark Kettenis
2001-04-30 18:14 ` Andrew Cagney
2001-05-01 13:38 ` [patch] change printf to fprintf_unfiltered Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox