headers/bsd: Add sys/queue.h.
[haiku.git] / src / kits / debugger / dwarf / AttributeValue.cpp
blob67b05f14cd8615a5e9346280033699dce3d4e90f
1 /*
2 * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include "AttributeValue.h"
8 #include <stdio.h>
10 #include "AttributeClasses.h"
13 const char*
14 AttributeValue::ToString(char* buffer, size_t size)
16 switch (attributeClass) {
17 case ATTRIBUTE_CLASS_ADDRESS:
18 snprintf(buffer, size, "%#" B_PRIx64, address);
19 return buffer;
20 case ATTRIBUTE_CLASS_BLOCK:
21 snprintf(buffer, size, "(%p, %#" B_PRIx64 ")", block.data,
22 block.length);
23 return buffer;
24 case ATTRIBUTE_CLASS_CONSTANT:
25 snprintf(buffer, size, "%#" B_PRIx64, constant);
26 return buffer;
27 case ATTRIBUTE_CLASS_FLAG:
28 snprintf(buffer, size, "%s", flag ? "true" : "false");
29 return buffer;
30 case ATTRIBUTE_CLASS_LINEPTR:
31 case ATTRIBUTE_CLASS_LOCLISTPTR:
32 case ATTRIBUTE_CLASS_MACPTR:
33 case ATTRIBUTE_CLASS_RANGELISTPTR:
34 snprintf(buffer, size, "%#" B_PRIx64, pointer);
35 return buffer;
36 case ATTRIBUTE_CLASS_REFERENCE:
37 snprintf(buffer, size, "%p", reference);
38 return buffer;
39 case ATTRIBUTE_CLASS_STRING:
40 snprintf(buffer, size, "\"%s\"", string);
41 return buffer;
43 default:
44 case ATTRIBUTE_CLASS_UNKNOWN:
45 return "<unknown>";
48 return buffer;