Skip to main content
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Tarassov2012-02-22 17:09:49 -0500
committerEugene Tarassov2012-02-22 17:09:49 -0500
commitbbc2155e8943486f181aeec4ec6cfb249589c19e (patch)
treeb0d34825a731b522dc3ca45987d619500c19a02f /tests
parent875a01057eeecf8968c1f6b8c37a1d0b748b0c50 (diff)
downloadorg.eclipse.tcf.agent-bbc2155e8943486f181aeec4ec6cfb249589c19e.tar.gz
org.eclipse.tcf.agent-bbc2155e8943486f181aeec4ec6cfb249589c19e.tar.xz
org.eclipse.tcf.agent-bbc2155e8943486f181aeec4ec6cfb249589c19e.zip
TCF Agent: better handling of "struct", "class", "union" and "enum" keywords in expressions.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-dwarf/tcf/backend/backend.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/tests/test-dwarf/tcf/backend/backend.c b/tests/test-dwarf/tcf/backend/backend.c
index fc6bd7c5..715b7595 100644
--- a/tests/test-dwarf/tcf/backend/backend.c
+++ b/tests/test-dwarf/tcf/backend/backend.c
@@ -635,25 +635,46 @@ static void loc_var_func(void * args, Symbol * sym) {
}
}
}
- else {
+ else if (container_class == SYM_CLASS_COMP_UNIT && type_name != NULL) {
Symbol * find_sym = NULL;
ContextAddress find_size = 0;
int find_class = 0;
+ SYM_FLAGS find_flags = 0;
uint64_t n = 0;
Value v;
- if (container_class == SYM_CLASS_COMP_UNIT && type_name != NULL) {
- if (find_symbol_by_name(elf_ctx, STACK_NO_FRAME, 0, type_name, &find_sym) < 0) {
- error("find_symbol_by_name");
- }
+ if (find_symbol_by_name(elf_ctx, STACK_NO_FRAME, 0, type_name, &find_sym) < 0) {
+ error("find_symbol_by_name");
+ }
+ for (;;) {
if (get_symbol_class(find_sym, &find_class) < 0) {
error("get_symbol_class");
}
+ if (get_symbol_flags(find_sym, &find_flags) < 0) {
+ error("get_symbol_flags");
+ }
switch (find_class) {
case SYM_CLASS_REFERENCE:
case SYM_CLASS_TYPE:
if (get_symbol_size(find_sym, &find_size) == 0) {
- char * expr = (char *)tmp_alloc(strlen(type_name) + 32);
- sprintf(expr, "sizeof(%s)", type_name);
+ char * expr = (char *)tmp_alloc(strlen(type_name) + 64);
+ if (find_class != SYM_CLASS_TYPE) {
+ sprintf(expr, "sizeof(%s)", type_name);
+ }
+ else if (find_flags & SYM_FLAG_STRUCT_TYPE) {
+ sprintf(expr, "sizeof(struct %s)", type_name);
+ }
+ else if (find_flags & SYM_FLAG_CLASS_TYPE) {
+ sprintf(expr, "sizeof(class %s)", type_name);
+ }
+ else if (find_flags & SYM_FLAG_UNION_TYPE) {
+ sprintf(expr, "sizeof(union %s)", type_name);
+ }
+ else if (find_flags & SYM_FLAG_ENUM_TYPE) {
+ sprintf(expr, "sizeof(enum %s)", type_name);
+ }
+ else {
+ sprintf(expr, "sizeof(%s)", type_name);
+ }
if (evaluate_expression(elf_ctx, STACK_NO_FRAME, 0, expr, 0, &v) < 0) {
error("evaluate_expression");
}
@@ -667,6 +688,7 @@ static void loc_var_func(void * args, Symbol * sym) {
}
break;
}
+ if (find_next_symbol(&find_sym) < 0) break;
}
}
if (get_symbol_length(type, &length) < 0) {

Back to the top