1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Brings in the main crash data definitions. Serialized crash data in a
16 : // minidump consists of a single Value object, which is an abstract base
17 : // type. Conceptually the entire structure is analogous to JSON, with a
18 : // few additional types for things that have special meaning in the context
19 : // of a crash.
20 : //
21 : // This also contains a family of helper functions for building crash data
22 : // protobufs.
23 :
24 : #ifndef SYZYGY_CRASHDATA_CRASHDATA_H_
25 : #define SYZYGY_CRASHDATA_CRASHDATA_H_
26 :
27 : // This is a simple wrapper to the automatically generated header file.
28 : #include "syzygy/crashdata/crashdata.pb.h"
29 :
30 m : namespace crashdata {
31 :
32 : // @name Functions for initializing values.
33 : // @{
34 :
35 : // Makes the given value a leaf.
36 : // @param value The value to be initialized.
37 : // @returns the nested leaf object.
38 m : Leaf* ValueGetLeaf(Value* value);
39 :
40 : // Makes the given value a list.
41 : // @param value The value to be initialized.
42 : // @returns the nested list object.
43 m : ValueList* ValueGetValueList(Value* value);
44 :
45 : // Makes the given value a dictionary.
46 : // @param value The value to be initialized.
47 : // @returns the nested dictionary object.
48 m : Dictionary* ValueGetDict(Value* value);
49 :
50 : // @}
51 :
52 : // @name Functions for adding a key-value to a dict.
53 : // @{
54 :
55 : // Adds a value to a dictionary.
56 : // @param key The key name.
57 : // @param dict The dictionary to be modified.
58 : // @returns a pointer to the created value.
59 m : Value* DictAddValue(const char* key, Dictionary* dict);
60 m : Value* DictAddValue(const std::string& key, Dictionary* dict);
61 :
62 : // Adds a value containing a leaf to a dictionary.
63 : // @param key The key name.
64 : // @param dict The dictionary to be modified.
65 : // @returns a pointer to the created leaf.
66 m : Leaf* DictAddLeaf(const char* key, Dictionary* dict);
67 m : Leaf* DictAddLeaf(const std::string& key, Dictionary* dict);
68 :
69 : // Adds a value containing a dictionary to a dictionary.
70 : // @param key The key name.
71 : // @param dict The dictionary to be modified.
72 : // @returns a pointer to the created dictionnary.
73 m : Dictionary* DictAddDict(const char* key, Dictionary* dict);
74 m : Dictionary* DictAddDict(const std::string& key, Dictionary* dict);
75 : // @}
76 :
77 : // @name Functions for initializing leaves.
78 : // @{
79 :
80 : // Makes the given leaf an integer.
81 : // @param value The value to set.
82 : // @param leaf The leaf to be modified.
83 m : void LeafSetInt(google::protobuf::int64 value, Leaf* leaf);
84 :
85 : // Makes the given leaf an unsigned integer.
86 : // @param value The value to set.
87 : // @param leaf The leaf to be modified.
88 m : void LeafSetUInt(google::protobuf::uint64 value, Leaf* leaf);
89 :
90 : // Makes the given leaf a real.
91 : // @param value The value to set.
92 : // @param leaf The leaf to be modified.
93 m : void LeafSetReal(double value, Leaf* leaf);
94 :
95 : // Makes the given leaf a string.
96 : // @param leaf The leaf to be initialized.
97 : // @returns the nested string object.
98 m : std::string* LeafGetString(Leaf* leaf);
99 :
100 : // Makes the given leaf an address.
101 : // @param leaf The leaf to be initialized.
102 : // @returns the nested address object.
103 m : Address* LeafGetAddress(Leaf* leaf);
104 :
105 : // Makes the given leaf a stack-trace.
106 : // @param leaf The leaf to be initialized.
107 : // @returns the nested stack-trace object.
108 m : StackTrace* LeafGetStackTrace(Leaf* leaf);
109 :
110 : // Makes the given leaf a blob.
111 : // @param leaf The leaf to be initialized.
112 : // @returns the nested blob object.
113 m : Blob* LeafGetBlob(Leaf* leaf);
114 :
115 : // @}
116 :
117 m : } // namespace crashdata
118 :
119 : #endif // SYZYGY_CRASHDATA_CRASHDATA_H_
|