public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "mjw at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/14434] New: dwflpp sometimes caches incomplete class_type
Date: Sun, 05 Aug 2012 18:25:00 -0000	[thread overview]
Message-ID: <bug-14434-6586@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=14434

             Bug #: 14434
           Summary: dwflpp sometimes caches incomplete class_type
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: mjw@redhat.com
    Classification: Unclassified


Take the following program:

::::::::::::::
header.hxx
::::::::::::::
#include <malloc.h>

class Heap
{
  private:
    char *_memory;
    size_t _size;
  public:
    Heap();
    void* allocate  (size_t size);
    static size_t header_size();
};
::::::::::::::
heap.cxx
::::::::::::::
#include "header.hxx"

size_t
Heap::header_size ()
{
  return 42;
}

Heap::Heap()
{
  _size = header_size () + 32;
  _memory = (char *) malloc (_size);
}

void*
Heap::allocate(size_t size)
{
  _size += size;
  return _memory + header_size();
}
::::::::::::::
main.cxx
::::::::::::::
#include "header.hxx"

int size (int resize)
{
  return (int)Heap::header_size() - resize;
}

int
main (int argc, char **argv)
{
  return size (argc);
}

Compile it with g++ 4.7.1:

$ g++ -g -O2 -c main.cxx
$ g++ -g -O2 -c heap.cxx
$ g++ -g main.o heap.o -o prog

Now try inspecting it with stap a couple of times and notice it occasionally
fails. In this example we are interested in the offset of one of the field
members of the Heap class and use @cast on address zero to get it:

$ stap -p2 -v -e 'probe process("./prog").function("main") { printf("_size
member offset: %d\n", &@cast(0, "Heap")->_size); }' > /dev/null
Pass 1: parsed user script and 96 library script(s) using
212776virt/34756res/3024shr/32128data kb, in 110usr/10sys/127real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 215824virt/36464res/3588shr/33056data kb, in 10usr/0sys/7real ms.
$ stap -p2 -v -e 'probe process("./prog").function("main") { printf("_size
member offset: %d\n", &@cast(0, "Heap")->_size); }' > /dev/null
Pass 1: parsed user script and 96 library script(s) using
212776virt/34756res/3024shr/32128data kb, in 110usr/10sys/129real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s)
using 215824virt/36464res/3588shr/33056data kb, in 10usr/0sys/7real ms.
$ stap -p2 -v -e 'probe process("./prog").function("main") { printf("_size
member offset: %d\n", &@cast(0, "Heap")->_size); }' > /dev/null
Pass 1: parsed user script and 96 library script(s) using
212776virt/34756res/3024shr/32128data kb, in 120usr/10sys/128real ms.
semantic error: unable to find member '_size' for class Heap: operator '->' at
<input>:1:97
        source: probe process("./prog").function("main") { printf("_size member
offset: %d\n", &@cast(0, "Heap")->_size); }
                                                                               
                                ^

Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s)
using 213716virt/36340res/3476shr/33052data kb, in 10usr/0sys/7real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.

Isn't that weird! It worked 2 out of 3 times, but then it suddenly failed.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

             reply	other threads:[~2012-08-05 18:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 18:25 mjw at redhat dot com [this message]
2012-08-05 18:51 ` [Bug translator/14434] " mjw at redhat dot com
2012-08-05 18:56 ` mjw at redhat dot com
2012-08-06 22:39 ` mjw at redhat dot com

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=bug-14434-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).