public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Vara Prasad <prasadav@us.ibm.com>,
	  Alan Cox <alan@lxorguk.ukuu.org.uk>,
	 "Frank Ch. Eigler" <fche@redhat.com>,
	Ingo Molnar <mingo@elte.hu>,   Paul Mundt <lethal@linux-sh.org>,
	 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	  linux-kernel <linux-kernel@vger.kernel.org>,
	 Jes Sorensen <jes@sgi.com>, Andrew Morton <akpm@osdl.org>,
	  Tom Zanussi <zanussi@us.ibm.com>,
	 Richard J Moore <richardj_moore@uk.ibm.com>,
	  Michel Dagenais <michel.dagenais@polymtl.ca>,
	 Christoph Hellwig <hch@infradead.org>,
	  Greg Kroah-Hartman <gregkh@suse.de>,
	 Thomas Gleixner <tglx@linutronix.de>,
	William Cohen <wcohen@redhat.com>,
	  "Martin J. Bligh" <mbligh@mbligh.org>,
	 systemtap <systemtap@sourceware.org>
Subject: Re: tracepoint maintainance models
Date: Fri, 06 Oct 2006 23:17:00 -0000	[thread overview]
Message-ID: <4526E3F5.9040400@goop.org> (raw)
In-Reply-To: <1160112791.30146.12.camel@localhost.localdomain>

Steven Rostedt wrote:
> Coming into this really late, and I'm still behind in reading this and
> related threads, but I want to throw this idea out, and it's getting
> late.
>
> On Mon, 2006-09-18 at 13:28 -0700, Vara Prasad wrote:
>   
>> Alan Cox wrote:
>>
>>     
>>>> This still doesn't solve the problem of compiler optimizing such that a 
>>>> variable i would like to read in my probe not being available at the 
>>>> probe point.
>>>>    
>>>>
>>>>         
>>> Then what we really need by the sound of it is enough gcc smarts to do
>>> something of the form
>>>
>>> 	.section "debugbits"
>>> 	
>>> 	.asciiz 'hook_sched'
>>> 	.dword l1	# Address to probe
>>> 	.word 1		# Argument count
>>> 	.dword gcc_magic_whatregister("next"); [ reg num or memory ]
>>> 	.dword gcc_magic_whataddress("next"); [ address if exists]
>>>
>>>
>>> Can gcc do any of that for us today ?
>>>
>>>  
>>>
>>>       
>> No, gcc doesn't do that today.
>>
>>
>>     
>
>
> ---- cut here ----
> #include <stdio.h>
>
> #define MARK(label, var)			\
> 	asm ("debug_" #label ":\n"		\
> 	     ".section .data\n"			\
> 	     #label "_" #var ": xor %0,%0\n"	\
> 	     ".previous" : : "r"(var))
>   

That's a nice idea.  As Frank pointed out, it does force things into 
register.  You could use "rm" as a constraint, so you can also get the 
location wherever it exists.  It will still force gcc into keeping the 
value around at all, but presumably if its interesting for a mark, its 
interesting to keep:

	asm volatile("..."		\
	    #label "_" #var ": mov %0,%%eax\n"	\
	".previous" : : "rm" (var))

and, aside from the naming issues, it could be a general expression 
rather than a specific variable.

Of course, this requires a more complex addressing mode decoder, but it 
does give gcc more flexibility.  And in principle this is all redundant, 
since DWARF should be able to encode all this too, and if you make use 
of the variable as an asm argument, gcc really should be outputting the 
debug info about it.

    J

      parent reply	other threads:[~2006-10-06 23:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060917143623.GB15534@elte.hu>
     [not found] ` <20060917153633.GA29987@Krystal>
     [not found]   ` <20060918000703.GA22752@elte.hu>
     [not found]     ` <450DF28E.3050101@opersys.com>
     [not found]       ` <20060918011352.GB30835@elte.hu>
     [not found]         ` <20060918122527.GC3951@redhat.com>
     [not found]           ` <20060918150231.GA8197@elte.hu>
     [not found]             ` <1158594491.6069.125.camel@localhost.localdomain>
     [not found]               ` <20060918152230.GA12631@elte.hu>
     [not found]                 ` <1158596341.6069.130.camel@localhost.localdomain>
     [not found]                   ` <20060918161526.GL3951@redhat.com>
     [not found]                     ` <1158598927.6069.141.camel@localhost.localdomain>
2006-09-18 19:11                       ` Vara Prasad
2006-09-18 19:26                         ` Alan Cox
2006-09-18 19:40                           ` Frank Ch. Eigler
2006-09-18 20:29                           ` Vara Prasad
2006-10-06  5:33                             ` Steven Rostedt
2006-10-06 13:03                               ` Frank Ch. Eigler
2006-10-06 14:23                                 ` Steven Rostedt
2006-10-06 23:17                               ` Jeremy Fitzhardinge [this message]

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=4526E3F5.9040400@goop.org \
    --to=jeremy@goop.org \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=fche@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hch@infradead.org \
    --cc=jes@sgi.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mbligh@mbligh.org \
    --cc=michel.dagenais@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=prasadav@us.ibm.com \
    --cc=richardj_moore@uk.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=systemtap@sourceware.org \
    --cc=tglx@linutronix.de \
    --cc=wcohen@redhat.com \
    --cc=zanussi@us.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).