~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to languages/cpp/debugger/gdbparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    begin                : Tue Aug 17 1999
 
3
    copyright            : (C) 1999 by John Birch
 
4
    email                : jbb@kdevelop.org
 
5
 ***************************************************************************/
 
6
 
 
7
/***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
 
 
16
#ifndef _GDBPARSER_H_
 
17
#define _GDBPARSER_H_
 
18
 
 
19
#include "variablewidget.h"
 
20
 
 
21
namespace GDBDebugger
 
22
{
 
23
 
 
24
class GDBParser
 
25
{
 
26
public:
 
27
    /** Strips gdb decorations from value of a single variable
 
28
        and sets text of 'item' appropriately.
 
29
        For values of composite types also calls item->setCache.
 
30
        Does not recurse into composite types and does not creates
 
31
        child items of 'item' (that will be done in item->setOpen,
 
32
        when that's method is called.
 
33
 
 
34
        "Decorations" are {} around arrays and structures and value
 
35
        type that is printed before value itself in some cases.
 
36
    */
 
37
    void parseValue(TrimmableItem *item, const char *buf);
 
38
 
 
39
    /** Parses gdb-provided value 'buf' of a composite type
 
40
        (struct/array), and assigns proper values to children
 
41
        of 'parent'. As a special hack, the output from
 
42
        "info locals" and "info args" can be passed to this
 
43
        method, as the output looks like just value of some
 
44
        imaginary 'struct local_variables'.
 
45
        The value should contain all the decorations from gdb
 
46
        (opening braces of arrays, and so on).
 
47
    */
 
48
    void parseCompositeValue(TrimmableItem* parent, const char* buf);
 
49
 
 
50
    DataType  determineType(const char *buf) const;
 
51
 
 
52
    const char *skipString(const char *buf) const;
 
53
    const char *skipQuotes(const char *buf, char quote) const;
 
54
    const char *skipDelim(const char *buf, char open, char close) const;
 
55
 
 
56
    static GDBParser *getGDBParser();
 
57
    static void destroy();
 
58
 
 
59
private:
 
60
    TrimmableItem *getItem(TrimmableItem *parent, DataType itemType,
 
61
                           const QString &varName, bool requested);
 
62
 
 
63
    void parseArray(TrimmableItem *parent, const char *buf);
 
64
 
 
65
    const char *skipTokenEnd(const char *buf) const;
 
66
    const char *skipTokenValue(const char *buf) const;
 
67
    const char *skipNextTokenStart(const char *buf) const;
 
68
 
 
69
    QString getName(const char **buf);
 
70
    /** Assuming 'buf' points to a value, return a pointer
 
71
        to the position right after the value.
 
72
    */
 
73
    QCString getValue(const char **buf);
 
74
    QCString undecorateValue(DataType type, const QCString& s);
 
75
    void setItem(TrimmableItem *parent, const QString &varName, DataType dataType,
 
76
                 const QCString &value, bool requested);
 
77
 
 
78
protected:
 
79
    GDBParser();
 
80
    ~GDBParser();
 
81
    static GDBParser *GDBParser_;
 
82
};
 
83
 
 
84
}
 
85
 
 
86
#endif