Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Stan Shebs <stan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Document tracepoint restrictions
Date: Fri, 12 Mar 2010 02:40:00 -0000	[thread overview]
Message-ID: <4B99A9A0.20500@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

While the savvy GDB hacker can use sekrit GDB internals knowledge to 
surmise what will and won't work with tracepoints, normal users can 
benefit from it being spelled out more explicitly.  This patch adds a 
new section to the manual that explains some of the gotchas our new 
generation of tracepoint users has experienced already.

Stan

2010-03-11  Stan Shebs  <stan@codesourcery.com>
        Nathan Sidwell  <nathan@codesourcery.com>

    * gdb.texinfo (Tracepoint Actions): Clarify that while-stepping is
    doing instruction stepping.
    (Tracepoint Restrictions): New node.


[-- Attachment #2: restrict-patch-1 --]
[-- Type: text/plain, Size: 5038 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/doc/ChangeLog,v
retrieving revision 1.1021
diff -p -r1.1021 ChangeLog
*** ChangeLog	10 Mar 2010 18:20:07 -0000	1.1021
--- ChangeLog	12 Mar 2010 02:33:51 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2010-03-11  Stan Shebs  <stan@codesourcery.com>
+ 	    Nathan Sidwell  <nathan@codesourcery.com>
+ 
+ 	* gdb.texinfo (Tracepoint Actions): Clarify that while-stepping is
+ 	doing instruction stepping.
+ 	(Tracepoint Restrictions): New node.
+ 
  2010-03-10  Tom Tromey  <tromey@redhat.com>
  
  	* gdbint.texinfo (Symbol Handling): Update.
Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.679
diff -p -r1.679 gdb.texinfo
*** gdb.texinfo	8 Mar 2010 19:20:38 -0000	1.679
--- gdb.texinfo	12 Mar 2010 02:33:52 -0000
*************** conditions and actions.
*** 9352,9357 ****
--- 9352,9358 ----
  * Tracepoint Actions::
  * Listing Tracepoints::
  * Starting and Stopping Trace Experiments::
+ * Tracepoint Restrictions::
  @end menu
  
  @node Create and Delete Tracepoints
*************** action were used.
*** 9668,9677 ****
  
  @kindex while-stepping @r{(tracepoints)}
  @item while-stepping @var{n}
! Perform @var{n} single-step traces after the tracepoint, collecting
! new data at each step.  The @code{while-stepping} command is
! followed by the list of what to collect while stepping (followed by
! its own @code{end} command):
  
  @smallexample
  > while-stepping 12
--- 9669,9678 ----
  
  @kindex while-stepping @r{(tracepoints)}
  @item while-stepping @var{n}
! Perform @var{n} single-step instruction traces after the tracepoint,
! collecting new data at each instruction.  The @code{while-stepping}
! command is followed by the list of what to collect while stepping
! (followed by its own @code{end} command):
  
  @smallexample
  > while-stepping 12
*************** which to specify that tracepoint.  This 
*** 9835,9840 ****
--- 9836,9900 ----
  necessarily heuristic, and it may result in useless tracepoints being
  created; you may simply delete them if they are of no use.
  
+ @node Tracepoint Restrictions
+ @subsection Tracepoint Restrictions
+ 
+ There are a number of restrictions on the use of tracepoints.
+ 
+ @itemize @bullet
+ 
+ @item
+ Tracepoint expressions are intended to gather objects (lvalues).  Thus
+ the full flexibility of GDB's expression evaluator is not available.
+ You cannot call functions, cast objects to aggregate types, access
+ convenience variables or modify values (except by assignment to trace
+ state variables).  Objective-C and Objective-C++ features are not
+ supported.
+ 
+ @item
+ Collection of local variables, either individually or in bulk with
+ @code{$locals} or @code{$args}, during @code{while-stepping} may
+ behave erratically.  The stepping action may enter a new scope (for
+ instance by stepping into a function), or the location of the variable
+ may change (for instance it is loaded into a register).  The
+ tracepoint data recorded uses the location information for the
+ variables that is correct for the tracepoint location.  When the
+ tracepoint is created, it is not possible, in general, to determine
+ where the steps of a @code{while-stepping} sequence will advance the
+ program -- particularly if a conditional branch is stepped.
+ 
+ @item
+ Collection of an incompletely-initialized or partially-destroyed object
+ may result in something that @value{GDBN} cannot display, or displays
+ in a misleading way.
+ 
+ @item
+ When @value{GDBN} displays a pointer to character it automatically
+ dereferences the pointer to also display characters of the string
+ being pointed to.  However, collecting the pointer during tracing does
+ not automatically collect the string.  You need to explicitly
+ dereference the pointer and provide size information if you want to
+ collect not only the pointer, but the memory pointed to.  For example
+ @code{*ptr@@50} can be used to collect the 50 element array pointed to
+ by @code{ptr}.
+ 
+ @item
+ It is not possible to collect a complete stack backtrace at a
+ tracepoint.  Instead you may collect the registers and a few hundred
+ bytes from the stack pointer with something like @code{*$esp@@300}
+ (adjust to use the name of the actual stack pointer register on your
+ target architecture, and the amount of stack you wish to capture).
+ Then the @code{backtrace} command will show a partial backtrace when
+ using a trace frame.  The number of stack frames that can be examined
+ depends on the sizes of the frames in the collected stack.
+ 
+ @end itemize
+ 
+ The above is not intended as an exhaustive list of restrictions.  As
+ described above, tracepoint data gathering occurs on the target
+ without interaction from GDB.  Thus the full capabilities of GDB are
+ not available during data gathering.
+ 
  @node Analyze Collected Data
  @section Using the Collected Data
  

             reply	other threads:[~2010-03-12  2:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12  2:40 Stan Shebs [this message]
2010-03-12  8:17 ` Eli Zaretskii
2010-03-12 18:51   ` Stan Shebs

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=4B99A9A0.20500@codesourcery.com \
    --to=stan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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