summaryrefslogtreecommitdiff
path: root/gprofng/src/DataObject.h
blob: f70bbad921e1d3cda51e619575b197519c5cd41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Copyright (C) 2021 Free Software Foundation, Inc.
   Contributed by Oracle.

   This file is part of GNU Binutils.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */

#ifndef _DATAOBJECT_H
#define _DATAOBJECT_H

// A DataObject object represents a distinct dataobject.

#include "dbe_structs.h"
#include "Histable.h"

extern char *DOBJ_UNSPECIFIED;
extern char *DOBJ_UNIDENTIFIED;
extern char *DOBJ_UNDETERMINED;
extern char *DOBJ_ANON;
extern char *DOBJ_UNASCERTAINABLE;
extern char *DOBJ_UNVERIFIABLE;
extern char *DOBJ_UNRESOLVABLE;

class DataObject : public Histable
{
public:
  DataObject ();
  ~DataObject ();

  static const unsigned UNSPECIFIED_ID = 0xFFFFFFFF;

  int64_t size;             // size of the dataobject in bytes
  int64_t offset;           // offset of dataobject from parent
  DataObject *parent;       // this dataobject's parent (if any)
  Histable *scope;          // scope of this dataobject
  DataObject *master;       // this dataobject's master (if any)

  Histable_type get_type ()         { return DOBJECT; }
  int64_t get_size ()               { return size; }
  int64_t get_offset ()             { return offset; }
  DataObject *get_parent ()         { return parent; }
  DataObject *get_master ()         { return master; }
  char *get_typename ()             { return _typename; }
  char *get_instname ()             { return _instname; }
  Histable *get_scope ()            { return scope; }

  char *get_unannotated_name ()
  { // name without a <Scalar> or <Unknown> prefix
    if (_unannotated_name)
      return _unannotated_name;
    return get_name ();
  }

  uint64_t get_addr ();
  char get_offset_mark ();
  char *get_offset_name ();
  void set_dobjname (char *type_name, char *inst_name); // dobj->parent must already be set
  void set_name (char *);
  Histable *convertto (Histable_type type, Histable *obj = NULL);
  DbeEA *find_dbeEA (Vaddr EA);

private:
  char *_unannotated_name;  // name without a <Scalar> or <Unknown> prefix
  char *_typename;          // name of this dataobject's type
  char *_instname;          // name of this dataobject instance
  Vector<DbeEA*> *EAs;
};

#endif  /* _DATAOBJECT_H */