1ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
2ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--------------------------------------------------------------------*/
3ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--- DebugInfo.                              pub_tool_debuginfo.h ---*/
4ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--------------------------------------------------------------------*/
5ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
6ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*
7ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   This file is part of Valgrind, a dynamic binary instrumentation
8ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   framework.
9ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
100f157ddb404bcde7815a1c5bf2d7e41c114f3d73sewardj   Copyright (C) 2000-2013 Julian Seward
11ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      jseward@acm.org
12ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
13ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   This program is free software; you can redistribute it and/or
14ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   modify it under the terms of the GNU General Public License as
15ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   published by the Free Software Foundation; either version 2 of the
16ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   License, or (at your option) any later version.
17ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
18ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   This program is distributed in the hope that it will be useful, but
19ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   WITHOUT ANY WARRANTY; without even the implied warranty of
20ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   General Public License for more details.
22ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
23ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   You should have received a copy of the GNU General Public License
24ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   along with this program; if not, write to the Free Software
25ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   02111-1307, USA.
27ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
28ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   The GNU General Public License is contained in the file COPYING.
29ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn*/
30ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
31ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn#ifndef __PUB_TOOL_DEBUGINFO_H
32ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn#define __PUB_TOOL_DEBUGINFO_H
33ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
34535fb1b49a80f2e880f755ee618381de3e222ddfflorian#include "pub_tool_basics.h"   // VG_ macro
35535fb1b49a80f2e880f755ee618381de3e222ddfflorian
36ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*====================================================================*/
37ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*=== Obtaining debug information                                  ===*/
38ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*====================================================================*/
39ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
40ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/* Get the file/function/line number of the instruction at address
41ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   'a'.  For these four, if debug info for the address is found, it
42ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   copies the info into the buffer/UInt and returns True.  If not, it
4346cc04521acf2827eb33310fadc119bf2dc039e4florian   returns False.  VG_(get_fnname) always
44ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   demangles C++ function names.  VG_(get_fnname_w_offset) is the
45ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   same, except it appends "+N" to symbol names to indicate offsets.  */
4610ef725f1e8e9f1615c483555348eb75b69c4713florianextern Bool VG_(get_filename) ( Addr a, const HChar** filename );
4746cc04521acf2827eb33310fadc119bf2dc039e4florianextern Bool VG_(get_fnname)   ( Addr a, const HChar** fnname );
48ea27e4627518665dd6c81213c0ba1f7ff0218e1anjnextern Bool VG_(get_linenum)  ( Addr a, UInt* linenum );
49ea27e4627518665dd6c81213c0ba1f7ff0218e1anjnextern Bool VG_(get_fnname_w_offset)
5046cc04521acf2827eb33310fadc119bf2dc039e4florian                              ( Addr a, const HChar** fnname );
51ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
527cee6f99bd38612f2d1c0102d75ca55839601538sewardj/* This one is the most general.  It gives filename, line number and
537cee6f99bd38612f2d1c0102d75ca55839601538sewardj   optionally directory name.  filename and linenum may not be NULL.
547cee6f99bd38612f2d1c0102d75ca55839601538sewardj   dirname may be NULL, meaning that the caller does not want
55f4384f47ee6b6234dba548a775585c37af712edfflorian   directory name info.
56f4384f47ee6b6234dba548a775585c37af712edfflorian   If dirname is non-null, directory info is written to *dirname, if
577cee6f99bd38612f2d1c0102d75ca55839601538sewardj   it is available; if not available, '\0' is written to the first
58f4384f47ee6b6234dba548a775585c37af712edfflorian   byte.
597cee6f99bd38612f2d1c0102d75ca55839601538sewardj
6010ef725f1e8e9f1615c483555348eb75b69c4713florian   The character strings returned in *filename and *dirname are not
6110ef725f1e8e9f1615c483555348eb75b69c4713florian   persistent. They will be freed when the DebugInfo they belong to
6210ef725f1e8e9f1615c483555348eb75b69c4713florian   is discarded.
6310ef725f1e8e9f1615c483555348eb75b69c4713florian
647cee6f99bd38612f2d1c0102d75ca55839601538sewardj   Returned value indicates whether any filename/line info could be
657cee6f99bd38612f2d1c0102d75ca55839601538sewardj   found. */
66ea27e4627518665dd6c81213c0ba1f7ff0218e1anjnextern Bool VG_(get_filename_linenum)
677cee6f99bd38612f2d1c0102d75ca55839601538sewardj                              ( Addr a,
6810ef725f1e8e9f1615c483555348eb75b69c4713florian                                /*OUT*/const HChar** filename,
6910ef725f1e8e9f1615c483555348eb75b69c4713florian                                /*OUT*/const HChar** dirname,
707cee6f99bd38612f2d1c0102d75ca55839601538sewardj                                /*OUT*/UInt* linenum );
71ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
72ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/* Succeeds only if we find from debug info that 'a' is the address of the
73ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   first instruction in a function -- as opposed to VG_(get_fnname) which
74ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   succeeds if we find from debug info that 'a' is the address of any
75ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   instruction in a function.  Use this to instrument the start of
76ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   a particular function.  Nb: if an executable/shared object is stripped
77ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   of its symbols, this function will not be able to recognise function
78ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   entry points within it. */
7946cc04521acf2827eb33310fadc119bf2dc039e4florianextern Bool VG_(get_fnname_if_entry) ( Addr a, const HChar** fnname );
80ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
816882443ef154bca367bc591287de641e43a9e108njntypedef
826882443ef154bca367bc591287de641e43a9e108njn   enum {
836882443ef154bca367bc591287de641e43a9e108njn      Vg_FnNameNormal,        // A normal function.
846882443ef154bca367bc591287de641e43a9e108njn      Vg_FnNameMain,          // "main"
856882443ef154bca367bc591287de641e43a9e108njn      Vg_FnNameBelowMain      // Something below "main", eg. __libc_start_main.
866882443ef154bca367bc591287de641e43a9e108njn   } Vg_FnNameKind;           //   Such names are often filtered.
876882443ef154bca367bc591287de641e43a9e108njn
886882443ef154bca367bc591287de641e43a9e108njn/* Indicates what kind of fnname it is. */
8946cc04521acf2827eb33310fadc119bf2dc039e4florianextern Vg_FnNameKind VG_(get_fnname_kind) ( const HChar* name );
906882443ef154bca367bc591287de641e43a9e108njn
916882443ef154bca367bc591287de641e43a9e108njn/* Like VG_(get_fnname_kind), but takes a code address. */
926882443ef154bca367bc591287de641e43a9e108njnextern Vg_FnNameKind VG_(get_fnname_kind_from_IP) ( Addr ip );
936882443ef154bca367bc591287de641e43a9e108njn
94b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Looks up data_addr in the collection of data symbols, and if found
95b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   puts its name (or as much as will fit) into dname[0 .. n_dname-1],
96b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   which is guaranteed to be zero terminated.  Also data_addr's offset
97b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   from the symbol start is put into *offset. */
98b8b79addf04dd5d0b558916e26df0b1927cbd758sewardjextern Bool VG_(get_datasym_and_offset)( Addr data_addr,
9946cc04521acf2827eb33310fadc119bf2dc039e4florian                                         /*OUT*/const HChar** dname,
100c4431bfe04c7490ea2d74939d222d87f13f30960njn                                         /*OUT*/PtrdiffT* offset );
101b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj
1025d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj/* Try to form some description of DATA_ADDR by looking at the DWARF3
10325963376a3669e7f77395d6f884bdf1f6a928966philippe   debug info we have.  This considers all global variables, and 8
1045d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   frames in the stacks of all threads.  Result is written at the ends
1055d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   of DNAME{1,2}V, which are XArray*s of HChar, that have been
1065d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   initialised by the caller, and True is returned.  If no description
1075d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   is created, False is returned.  Regardless of the return value,
1085d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   DNAME{1,2}V are guaranteed to be zero terminated after the call.
1095d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj
1105d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   Note that after the call, DNAME{1,2} may have more than one
1115d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   trailing zero, so callers should establish the useful text length
1125d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   using VG_(strlen) on the contents, rather than VG_(sizeXA) on the
1135d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj   XArray itself.
1145d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj*/
1155d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardjBool VG_(get_data_description)(
1165d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj        /*MOD*/ void* /* really, XArray* of HChar */ dname1v,
1175d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj        /*MOD*/ void* /* really, XArray* of HChar */ dname2v,
1185d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj        Addr data_addr
1195d9dc759eca2ad3c62d1df1b62c85fbc11c25aaasewardj     );
120b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj
121ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/* Succeeds if the address is within a shared object or the main executable.
122ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   It doesn't matter if debug info is present or not. */
12346cc04521acf2827eb33310fadc119bf2dc039e4florianextern Bool VG_(get_objname)  ( Addr a, const HChar** objname );
124ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
125a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe
126a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe/* Cursor allowing to describe inlined function calls at an IP,
127a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   by doing successive calls to VG_(describe_IP). */
128a0a73939b0398b6608fd6dbde49820ce6530d12cphilippetypedef  struct _InlIPCursor InlIPCursor;
129a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe
130770a8d23e40b980b5745e59ecb8e4037d81af357florian/* Returns info about the code address %eip:  the address, function
131ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   name (if known) and filename/line number (if known), like this:
132ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
133ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      0x4001BF05: realloc (vg_replace_malloc.c:339)
134ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
135a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   eip can possibly corresponds to inlined function call(s).
136a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   To describe eip and the inlined function calls, the following must
137a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   be done:
138a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe       InlIPCursor *iipc = VG_(new_IIPC)(eip);
139a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe       do {
140770a8d23e40b980b5745e59ecb8e4037d81af357florian          buf = VG_(describe_IP)(eip, iipc);
141a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe          ... use buf ...
142a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe       } while (VG_(next_IIPC)(iipc));
143a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe       VG_(delete_IIPC)(iipc);
144a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe
145a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   To only describe eip, without the inlined calls at eip, give a NULL iipc:
146770a8d23e40b980b5745e59ecb8e4037d81af357florian       buf = VG_(describe_IP)(eip, NULL);
147770a8d23e40b980b5745e59ecb8e4037d81af357florian
148770a8d23e40b980b5745e59ecb8e4037d81af357florian   Note, that the returned string is allocated in a static buffer local to
149770a8d23e40b980b5745e59ecb8e4037d81af357florian   VG_(describe_IP). That buffer will be overwritten with every invocation.
150770a8d23e40b980b5745e59ecb8e4037d81af357florian   Therefore, callers need to possibly stash away the string.
151ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn*/
152770a8d23e40b980b5745e59ecb8e4037d81af357florianextern const HChar* VG_(describe_IP)(Addr eip, const InlIPCursor* iipc);
153a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe
154a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe/* Builds a IIPC (Inlined IP Cursor) to describe eip and all the inlined calls
155a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   at eip. Such a cursor must be deleted after use using VG_(delete_IIPC). */
156a0a73939b0398b6608fd6dbde49820ce6530d12cphilippeextern InlIPCursor* VG_(new_IIPC)(Addr eip);
157a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe/* Move the cursor to the next call to describe.
158a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   Returns True if there are still calls to describe.
159a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe   False if nothing to describe anymore. */
160a0a73939b0398b6608fd6dbde49820ce6530d12cphilippeextern Bool VG_(next_IIPC)(InlIPCursor *iipc);
161a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe/* Free all memory associated with iipc. */
162a0a73939b0398b6608fd6dbde49820ce6530d12cphilippeextern void VG_(delete_IIPC)(InlIPCursor *iipc);
163a0a73939b0398b6608fd6dbde49820ce6530d12cphilippe
164ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
1659c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1669c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj/* Get an XArray of StackBlock which describe the stack (auto) blocks
1679c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   for this ip.  The caller is expected to free the XArray at some
1689c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   point.  If 'arrays_only' is True, only array-typed blocks are
1699c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   returned; otherwise blocks of all types are returned. */
1709c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1719c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjtypedef
1729c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   struct {
173c4431bfe04c7490ea2d74939d222d87f13f30960njn      PtrdiffT base;       /* offset from sp or fp */
174c4431bfe04c7490ea2d74939d222d87f13f30960njn      SizeT    szB;        /* size in bytes */
175c4431bfe04c7490ea2d74939d222d87f13f30960njn      Bool     spRel;      /* True => sp-rel, False => fp-rel */
176c4431bfe04c7490ea2d74939d222d87f13f30960njn      Bool     isVec;      /* does block have an array type, or not? */
177c4431bfe04c7490ea2d74939d222d87f13f30960njn      HChar    name[16];   /* first 15 chars of name (asciiz) */
1789c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   }
1799c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   StackBlock;
1809c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1819c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjextern void* /* really, XArray* of StackBlock */
1829c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj             VG_(di_get_stack_blocks_at_ip)( Addr ip, Bool arrays_only );
1839c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1849c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1859c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj/* Get an array of GlobalBlock which describe the global blocks owned
1869c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   by the shared object characterised by the given di_handle.  Asserts
1879c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   if the handle is invalid.  The caller is responsible for freeing
1889c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   the array at some point.  If 'arrays_only' is True, only
1899c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   array-typed blocks are returned; otherwise blocks of all types are
1909c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   returned. */
1919c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
1929c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjtypedef
1939c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   struct {
1949c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj      Addr  addr;
1959c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj      SizeT szB;
1969c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj      Bool  isVec;      /* does block have an array type, or not? */
1979c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj      HChar name[16];   /* first 15 chars of name (asciiz) */
1989c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj      HChar soname[16]; /* first 15 chars of name (asciiz) */
1999c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   }
2009c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj   GlobalBlock;
2019c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
2029c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjextern void* /* really, XArray* of GlobalBlock */
2039c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardjVG_(di_get_global_blocks_from_dihandle) ( ULong di_handle,
2049c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj                                          Bool  arrays_only );
2059c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
2069c606bd8634cd6b67bb41fa645b5c639668cfa2dsewardj
207ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*====================================================================*/
208e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj/*=== Obtaining debug information                                  ===*/
209ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*====================================================================*/
210ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
211e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj/* A way to make limited debuginfo queries on a per-mapped-object
212e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   basis. */
213e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjtypedef  struct _DebugInfo  DebugInfo;
214ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
215b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Returns NULL if the DebugInfo isn't found.  It doesn't matter if
216b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   debug info is present or not. */
217e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjDebugInfo* VG_(find_DebugInfo) ( Addr a );
218ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
219b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Fish bits out of DebugInfos. */
220e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjAddr          VG_(DebugInfo_get_text_avma)   ( const DebugInfo *di );
221e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjSizeT         VG_(DebugInfo_get_text_size)   ( const DebugInfo *di );
2223898022a7d74a227d6a35102faaedd420ed3a1c1bartAddr          VG_(DebugInfo_get_bss_avma)    ( const DebugInfo *di );
2233898022a7d74a227d6a35102faaedd420ed3a1c1bartSizeT         VG_(DebugInfo_get_bss_size)    ( const DebugInfo *di );
224e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjAddr          VG_(DebugInfo_get_plt_avma)    ( const DebugInfo *di );
225e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjSizeT         VG_(DebugInfo_get_plt_size)    ( const DebugInfo *di );
226e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjAddr          VG_(DebugInfo_get_gotplt_avma) ( const DebugInfo *di );
227e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjSizeT         VG_(DebugInfo_get_gotplt_size) ( const DebugInfo *di );
22868347837b3d82e48f85daff33ec7ba528891e4e7bartAddr          VG_(DebugInfo_get_got_avma)    ( const DebugInfo *di );
22968347837b3d82e48f85daff33ec7ba528891e4e7bartSizeT         VG_(DebugInfo_get_got_size)    ( const DebugInfo *di );
2301636d33c13958b9c0e7d3059cdd5005746418eb2florianconst HChar*  VG_(DebugInfo_get_soname)      ( const DebugInfo *di );
2311636d33c13958b9c0e7d3059cdd5005746418eb2florianconst HChar*  VG_(DebugInfo_get_filename)    ( const DebugInfo *di );
232e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjPtrdiffT      VG_(DebugInfo_get_text_bias)   ( const DebugInfo *di );
233e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj
234e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj/* Function for traversing the DebugInfo list.  When called with NULL
235e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   it returns the first element; otherwise it returns the given
236e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   element's successor.  Note that the order of elements in the list
237e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   changes in response to most of the queries listed in this header,
238e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   that explicitly or implicitly have to search the list for a
239e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   particular code address.  So it isn't safe to assume that the order
240e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardj   of the list stays constant. */
241e3f1e5988a94af9230f67273ca9236c4d7e8b8dasewardjconst DebugInfo* VG_(next_DebugInfo)    ( const DebugInfo *di );
2420ec07f32bbbb209d749b9974408e6f025ad40b31sewardj
243b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* A simple enumeration to describe the 'kind' of various kinds of
244b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   segments that arise from the mapping of object files. */
245ea27e4627518665dd6c81213c0ba1f7ff0218e1anjntypedef
246ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   enum {
247ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      Vg_SectUnknown,
248ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      Vg_SectText,
249ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      Vg_SectData,
250ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      Vg_SectBSS,
251ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn      Vg_SectGOT,
252b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj      Vg_SectPLT,
253092b6268cc4a38ae9ee41d1e3355937536ddc579bart      Vg_SectGOTPLT,
254b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj      Vg_SectOPD
255ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   }
256ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn   VgSectKind;
257ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
258b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Convert a VgSectKind to a string, which must be copied if you want
259b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj   to change it. */
260b8b79addf04dd5d0b558916e26df0b1927cbd758sewardjconst HChar* VG_(pp_SectKind)( VgSectKind kind );
261b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj
262b8b79addf04dd5d0b558916e26df0b1927cbd758sewardj/* Given an address 'a', make a guess of which section of which object
263e08950b4ce5a3f5d75a7279548f975cd6207dc74florian   it comes from.  If name is non-NULL, then the object's name is put
264e08950b4ce5a3f5d75a7279548f975cd6207dc74florian   into *name. The returned name is persistent as long as the debuginfo
265e08950b4ce5a3f5d75a7279548f975cd6207dc74florian   it belongs to isn't discarded. */
266e08950b4ce5a3f5d75a7279548f975cd6207dc74florianVgSectKind VG_(DebugInfo_sect_kind)( /*OUT*/const HChar** name, Addr a);
267bbec7728efefaa650970dd1f0282b77040287133sewardj
268bbec7728efefaa650970dd1f0282b77040287133sewardj
269ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn#endif   // __PUB_TOOL_DEBUGINFO_H
270ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn
271ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--------------------------------------------------------------------*/
272ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--- end                                                          ---*/
273ea27e4627518665dd6c81213c0ba1f7ff0218e1anjn/*--------------------------------------------------------------------*/
274