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 : List* ValueGetList(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 :
70 : // @name Functions for initializing leaves.
71 : // @{
72 :
73 : // Makes the given leaf an integer.
74 : // @param value The value to set.
75 : // @param leaf The leaf to be modified.
76 m : void LeafSetInt(google::protobuf::int64 value, Leaf* leaf);
77 :
78 : // Makes the given leaf an unsigned integer.
79 : // @param value The value to set.
80 : // @param leaf The leaf to be modified.
81 m : void LeafSetUInt(google::protobuf::uint64 value, Leaf* leaf);
82 :
83 : // Makes the given leaf a real.
84 : // @param value The value to set.
85 : // @param leaf The leaf to be modified.
86 m : void LeafSetReal(double value, Leaf* leaf);
87 :
88 : // Makes the given leaf a string.
89 : // @param leaf The leaf to be initialized.
90 : // @returns the nested string object.
91 m : std::string* LeafGetString(Leaf* leaf);
92 :
93 : // Makes the given leaf an address.
94 : // @param leaf The leaf to be initialized.
95 : // @returns the nested address object.
96 m : Address* LeafGetAddress(Leaf* leaf);
97 :
98 : // Makes the given leaf a stack-trace.
99 : // @param leaf The leaf to be initialized.
100 : // @returns the nested stack-trace object.
101 m : StackTrace* LeafGetStackTrace(Leaf* leaf);
102 :
103 : // Makes the given leaf a blob.
104 : // @param leaf The leaf to be initialized.
105 : // @returns the nested blob object.
106 m : Blob* LeafGetBlob(Leaf* leaf);
107 :
108 : // @}
109 :
110 m : } // namespace crashdata
111 :
112 : #endif // SYZYGY_CRASHDATA_CRASHDATA_H_
|