This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/14434] New: dwflpp sometimes caches incomplete class_type


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]