Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: "Amit S. Kale" <amitkale@linsyssoft.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: kgdb support for gdb
Date: Mon, 04 Oct 2004 15:55:00 -0000	[thread overview]
Message-ID: <4161725C.6050009@gnu.org> (raw)
In-Reply-To: <200410011314.33157.amitkale@linsyssoft.com>

> Index: src/gdb/stack.c
> ===================================================================
> --- src.orig/gdb/stack.c	2004-08-03 06:27:26.000000000 +0530
> +++ src/gdb/stack.c	2004-10-01 12:59:38.000000000 +0530
> @@ -45,6 +45,7 @@
>  #include "dictionary.h"
>  #include "reggroups.h"
>  #include "regcache.h"
> +#include "objfiles.h"

See Mark's general comments - I agree, the support should be there on 
all GNU/Linux systems, and not require special customization.

As for details of the lk files, I'll leave that to GNU/Linux patch revierws.

However, for the frame stuff, I've noticed the below.  Yes it's long. 
But mostly mechanical:

- "gdb doesn't lie"
This means that if the stack contains a context frame then the context 
frame is included in the backtrace.  Adding a feature to supresses 
certain frames in a back-trace would be interesting but, I think, should 
be added separatly (and needs to be user configurable).

- __sched_text_start
stack.c should definitly not be directly testing that.  Instead ...

- frame attributes
... the code should start testing for frame attributes: is this a callee 
frame; ......

- <context switch>
A things-to-do-today task is modify the stack/frame/... code so that it 
displays something like:
	stopped at <signal trampoline>+0x23
(i.e, the offset into the signal trampoline is displayed - at present it 
isn't) are you interested in trying to [separatly] fix this?

- dissassemble
I'm curious, does disassemble work for these context frames?  It 
currently doesn't for signal trampolines.

- PC_REGNUM and SP_REGNUM
I noticed code refering to these - they are definitly on their way out - 
you'll need to find another way of implementing that.  I'm also 
wondering about the lm-tdep code that computes the frame ID, the code 
addr should be the start of that code block and not the current PC - a 
frame ID's code and stack addresses are both constant through out the 
lifetime of a frame.

- testing
As with signal trampolines, we'll need to ensure that this is tested. 
It should be possible to construct testsuite additions that show GDB 
backtracing at least through one of these frames (Past experience has 
taught us that untested code unfortunatly and consistently bitrots).  I 
think it's possible to construct something without requiring a kernel.

- coding http://www.gnu.org/prep/standards_toc.html
One querk to check is GDB's comment style.

I think we can wack these out relatively quickly.

Andrew

>  /* Prototypes for exported functions. */
>  
> @@ -420,9 +421,14 @@
>    struct symtab_and_line sal;
>    int source_print;
>    int location_print;
> +  CORE_ADDR pc;
> +  struct frame_id fid;
> +  struct minimal_symbol *schedbegin;
> +  struct minimal_symbol *schedend;
>  
>    if (get_frame_type (fi) == DUMMY_FRAME
> -      || get_frame_type (fi) == SIGTRAMP_FRAME)
> +      || get_frame_type (fi) == SIGTRAMP_FRAME
> +      || (get_frame_type (fi) == CONTEXT_FRAME && print_level != 0))
>      {
>        struct cleanup *uiout_cleanup
>  	= make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
> @@ -455,12 +461,38 @@
>  	  annotate_signal_handler_caller ();
>            ui_out_field_string (uiout, "func", "<signal handler called>");
>          }
> +      else if (get_frame_type (fi) == CONTEXT_FRAME)
> +        {
> +	  annotate_context_entry ();
> +          ui_out_field_string (uiout, "func", "<context switch>");
> +        }
>        ui_out_text (uiout, "\n");
>        annotate_frame_end ();
>  
>        do_cleanups (uiout_cleanup);
>        return;
>      }
> +  /* Don't print context switch and scheduler frames if we are at level 0. */
> +  if (get_frame_type (fi) == CONTEXT_FRAME)
> +    {
> +      schedbegin = lookup_minimal_symbol("__sched_text_start", NULL,
> +					 symfile_objfile);
> +      schedend = lookup_minimal_symbol("__sched_text_end", NULL,
> +				       symfile_objfile);
> +      if (schedbegin && schedend)
> +	while ((fi = get_prev_frame(fi)) != NULL)
> +	  {
> +	    fid = get_frame_id(fi);
> +	    pc = 0;
> +	    if (!fid.code_addr_p)
> +	      break;
> +	    pc = get_frame_id(fi).code_addr; 
> +	    if (SYMBOL_VALUE_ADDRESS(schedbegin) >= pc)
> +	      break;
> +	    if (SYMBOL_VALUE_ADDRESS(schedend) <= pc)
> +	      break;
> +	  }
> +    }
>  
>    /* If fi is not the innermost frame, that normally means that fi->pc
>       points to *after* the call instruction, and we want to get the


  parent reply	other threads:[~2004-10-04 15:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01  7:45 Amit S. Kale
2004-10-01  9:13 ` Andreas Schwab
2004-10-01  9:57   ` Amit S. Kale
2004-10-01 22:01 ` Mark Kettenis
2004-10-02  3:52   ` Amit S. Kale
2004-10-02 22:48     ` Mark Kettenis
2004-10-04 14:56     ` Andrew Cagney
2004-10-19 12:45     ` Amit S. Kale
2004-10-04 15:14 ` Andrew Cagney
2004-10-04 15:42   ` Amit S. Kale
2004-10-19 12:55   ` Amit S. Kale
2004-10-04 15:55 ` Andrew Cagney [this message]
2004-10-04 16:36   ` Amit S. Kale
2004-10-04 17:23     ` Daniel Jacobowitz
2004-10-25  5:50       ` Amit S. Kale

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4161725C.6050009@gnu.org \
    --to=cagney@gnu.org \
    --cc=amitkale@linsyssoft.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox