public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* How to give compiler arguments
@ 2013-09-06 18:42 Martin Martin
  2013-09-06 19:17 ` David Smith
  2013-09-06 19:42 ` Josh Stone
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Martin @ 2013-09-06 18:42 UTC (permalink / raw)
  To: systemtap

Hi,

If I put:

%{
#include "stdint.h"
%}

at the start of my probe script, stap says:


In file included from
/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.c:24:0:
/usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdint.h:3:26: error: no
include path in which to search for stdint.h
make[1]: *** [/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.o]
Error 1

Is there a way to give some extra arguments to the compiler to resolve
this?  Or am I out of luck because it's a kernel module?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to give compiler arguments
  2013-09-06 18:42 How to give compiler arguments Martin Martin
@ 2013-09-06 19:17 ` David Smith
  2013-09-06 19:42 ` Josh Stone
  1 sibling, 0 replies; 4+ messages in thread
From: David Smith @ 2013-09-06 19:17 UTC (permalink / raw)
  To: Martin Martin; +Cc: systemtap

On 09/06/2013 01:42 PM, Martin Martin wrote:
> Hi,
> 
> If I put:
> 
> %{
> #include "stdint.h"
> %}
> 
> at the start of my probe script, stap says:
> 
> 
> In file included from
> /tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.c:24:0:
> /usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdint.h:3:26: error: no
> include path in which to search for stdint.h
> make[1]: *** [/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.o]
> Error 1
> 
> Is there a way to give some extra arguments to the compiler to resolve
> this?  Or am I out of luck because it's a kernel module?

Systemtap modules are real kernel modules, and thus have no access to
glibc (or its headers).

You can change the value of defines on the stap command line, like
'-DFOO=1'.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to give compiler arguments
  2013-09-06 18:42 How to give compiler arguments Martin Martin
  2013-09-06 19:17 ` David Smith
@ 2013-09-06 19:42 ` Josh Stone
  2013-09-06 20:07   ` Martin Martin
  1 sibling, 1 reply; 4+ messages in thread
From: Josh Stone @ 2013-09-06 19:42 UTC (permalink / raw)
  To: Martin Martin; +Cc: systemtap

On 09/06/2013 11:42 AM, Martin Martin wrote:
> Hi,
> 
> If I put:
> 
> %{
> #include "stdint.h"
> %}
> 
> at the start of my probe script, stap says:
> 
> 
> In file included from
> /tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.c:24:0:
> /usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdint.h:3:26: error: no
> include path in which to search for stdint.h
> make[1]: *** [/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.o]
> Error 1
> 
> Is there a way to give some extra arguments to the compiler to resolve
> this?  Or am I out of luck because it's a kernel module?

That's the right line of thought -- as a kernel module, stap can only
include kernel headers.  We do have --runtime=dyninst which runs as a
shared object, but the usage model is a bit different there.

If "stdint.h" is really what you're after, then "linux/types.h" has a
lot of the same definitions, and is already included by default.  If
that's just an example and you're really after some purely userspace
definitions, you may be out of luck.  However, another option in stap
functions (not embedded-C) is to use @cast for user types, like:

  @cast(my_pointer, "Elf32_Ehdr", "<elf.h>")->e_machine.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to give compiler arguments
  2013-09-06 19:42 ` Josh Stone
@ 2013-09-06 20:07   ` Martin Martin
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Martin @ 2013-09-06 20:07 UTC (permalink / raw)
  To: Josh Stone; +Cc: systemtap

Thanks a lot for your help.  I'm exploring the use of systemtap as the
core of a fault injection framework for a user-space program. Having
the probe script be able to modify return codes, local variables and
other values is quite attractive.  I can always put any complicated
functionality in my user application, and have systemtap trigger a
branch into it, e.g. by setting some local variable in my application.

Thanks,
Martin

On Fri, Sep 6, 2013 at 3:00 PM, Josh Stone <jistone@redhat.com> wrote:
> On 09/06/2013 11:42 AM, Martin Martin wrote:
>> Hi,
>>
>> If I put:
>>
>> %{
>> #include "stdint.h"
>> %}
>>
>> at the start of my probe script, stap says:
>>
>>
>> In file included from
>> /tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.c:24:0:
>> /usr/lib/gcc/x86_64-linux-gnu/4.7/include/stdint.h:3:26: error: no
>> include path in which to search for stdint.h
>> make[1]: *** [/tmp/stapR3xMcm/stap_a41ca76a927c0e462ab230035f8677ed_1654_src.o]
>> Error 1
>>
>> Is there a way to give some extra arguments to the compiler to resolve
>> this?  Or am I out of luck because it's a kernel module?
>
> That's the right line of thought -- as a kernel module, stap can only
> include kernel headers.  We do have --runtime=dyninst which runs as a
> shared object, but the usage model is a bit different there.
>
> If "stdint.h" is really what you're after, then "linux/types.h" has a
> lot of the same definitions, and is already included by default.  If
> that's just an example and you're really after some purely userspace
> definitions, you may be out of luck.  However, another option in stap
> functions (not embedded-C) is to use @cast for user types, like:
>
>   @cast(my_pointer, "Elf32_Ehdr", "<elf.h>")->e_machine.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-06 20:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 18:42 How to give compiler arguments Martin Martin
2013-09-06 19:17 ` David Smith
2013-09-06 19:42 ` Josh Stone
2013-09-06 20:07   ` Martin Martin

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).