xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/DataObject.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1*cb63e24eSchristos /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
24f645668Schristos    Contributed by Oracle.
34f645668Schristos 
44f645668Schristos    This file is part of GNU Binutils.
54f645668Schristos 
64f645668Schristos    This program is free software; you can redistribute it and/or modify
74f645668Schristos    it under the terms of the GNU General Public License as published by
84f645668Schristos    the Free Software Foundation; either version 3, or (at your option)
94f645668Schristos    any later version.
104f645668Schristos 
114f645668Schristos    This program is distributed in the hope that it will be useful,
124f645668Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
134f645668Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
144f645668Schristos    GNU General Public License for more details.
154f645668Schristos 
164f645668Schristos    You should have received a copy of the GNU General Public License
174f645668Schristos    along with this program; if not, write to the Free Software
184f645668Schristos    Foundation, 51 Franklin Street - Fifth Floor, Boston,
194f645668Schristos    MA 02110-1301, USA.  */
204f645668Schristos 
214f645668Schristos #ifndef _DATAOBJECT_H
224f645668Schristos #define _DATAOBJECT_H
234f645668Schristos 
244f645668Schristos // A DataObject object represents a distinct dataobject.
254f645668Schristos 
264f645668Schristos #include "dbe_structs.h"
274f645668Schristos #include "Histable.h"
284f645668Schristos 
294f645668Schristos extern char *DOBJ_UNSPECIFIED;
304f645668Schristos extern char *DOBJ_UNIDENTIFIED;
314f645668Schristos extern char *DOBJ_UNDETERMINED;
324f645668Schristos extern char *DOBJ_ANON;
334f645668Schristos extern char *DOBJ_UNASCERTAINABLE;
344f645668Schristos extern char *DOBJ_UNVERIFIABLE;
354f645668Schristos extern char *DOBJ_UNRESOLVABLE;
364f645668Schristos 
374f645668Schristos class DataObject : public Histable
384f645668Schristos {
394f645668Schristos public:
404f645668Schristos   DataObject ();
414f645668Schristos   ~DataObject ();
424f645668Schristos 
434f645668Schristos   static const unsigned UNSPECIFIED_ID = 0xFFFFFFFF;
444f645668Schristos 
454f645668Schristos   int64_t size;             // size of the dataobject in bytes
464f645668Schristos   int64_t offset;           // offset of dataobject from parent
474f645668Schristos   DataObject *parent;       // this dataobject's parent (if any)
484f645668Schristos   Histable *scope;          // scope of this dataobject
494f645668Schristos   DataObject *master;       // this dataobject's master (if any)
504f645668Schristos 
get_type()514f645668Schristos   Histable_type get_type ()         { return DOBJECT; }
get_size()524f645668Schristos   int64_t get_size ()               { return size; }
get_offset()534f645668Schristos   int64_t get_offset ()             { return offset; }
get_parent()544f645668Schristos   DataObject *get_parent ()         { return parent; }
get_master()554f645668Schristos   DataObject *get_master ()         { return master; }
get_typename()564f645668Schristos   char *get_typename ()             { return _typename; }
get_instname()574f645668Schristos   char *get_instname ()             { return _instname; }
get_scope()584f645668Schristos   Histable *get_scope ()            { return scope; }
594f645668Schristos 
get_unannotated_name()604f645668Schristos   char *get_unannotated_name ()
614f645668Schristos   { // name without a <Scalar> or <Unknown> prefix
624f645668Schristos     if (_unannotated_name)
634f645668Schristos       return _unannotated_name;
644f645668Schristos     return get_name ();
654f645668Schristos   }
664f645668Schristos 
674f645668Schristos   uint64_t get_addr ();
684f645668Schristos   char get_offset_mark ();
694f645668Schristos   char *get_offset_name ();
704f645668Schristos   void set_dobjname (char *type_name, char *inst_name); // dobj->parent must already be set
714f645668Schristos   void set_name (char *);
724f645668Schristos   Histable *convertto (Histable_type type, Histable *obj = NULL);
734f645668Schristos   DbeEA *find_dbeEA (Vaddr EA);
744f645668Schristos 
754f645668Schristos private:
764f645668Schristos   char *_unannotated_name;  // name without a <Scalar> or <Unknown> prefix
774f645668Schristos   char *_typename;          // name of this dataobject's type
784f645668Schristos   char *_instname;          // name of this dataobject instance
794f645668Schristos   Vector<DbeEA*> *EAs;
804f645668Schristos };
814f645668Schristos 
824f645668Schristos #endif  /* _DATAOBJECT_H */
83