[Ltrace-devel] [RFC 2/5] Abort on unsupported value types in the backends
edgar.iglesias at gmail.com
edgar.iglesias at gmail.com
Fri Oct 5 13:36:27 UTC 2012
From: "Edgar E. Iglesias" <edgar at axis.com>
Makes it easier to add new types.
Signed-off-by: Edgar E. Iglesias <edgar at axis.com>
---
sysdeps/linux-gnu/ia64/fetch.c | 5 ++---
sysdeps/linux-gnu/m68k/fetch.c | 2 +-
sysdeps/linux-gnu/s390/fetch.c | 4 ++++
sysdeps/linux-gnu/s390/trace.c | 10 ++++++----
sysdeps/linux-gnu/x86/fetch.c | 7 ++++++-
sysdeps/linux-gnu/x86/trace.c | 12 +++++++-----
6 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/sysdeps/linux-gnu/ia64/fetch.c b/sysdeps/linux-gnu/ia64/fetch.c
index 2163801..54dc5b8 100644
--- a/sysdeps/linux-gnu/ia64/fetch.c
+++ b/sysdeps/linux-gnu/ia64/fetch.c
@@ -438,11 +438,10 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
case ARGTYPE_ARRAY:
/* Arrays decay into pointers. XXX Fortran? */
- assert(info->type != ARGTYPE_ARRAY);
+ default:
+ assert(info->type != info->type);
abort();
}
- assert("unhandled type");
- abort();
}
int
diff --git a/sysdeps/linux-gnu/m68k/fetch.c b/sysdeps/linux-gnu/m68k/fetch.c
index a92057b..5da09e9 100644
--- a/sysdeps/linux-gnu/m68k/fetch.c
+++ b/sysdeps/linux-gnu/m68k/fetch.c
@@ -224,7 +224,7 @@ arch_fetch_retval(struct fetch_context *context, enum tof type,
}
return 0;
- case ARGTYPE_ARRAY:
+ default:
assert(!"Unexpected m68k retval type!");
abort();
}
diff --git a/sysdeps/linux-gnu/s390/fetch.c b/sysdeps/linux-gnu/s390/fetch.c
index c46ef7c..498c923 100644
--- a/sysdeps/linux-gnu/s390/fetch.c
+++ b/sysdeps/linux-gnu/s390/fetch.c
@@ -259,6 +259,10 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
case ARGTYPE_USHORT:
case ARGTYPE_POINTER:
return allocate_gpr(ctx, proc, info, valuep, sz);
+
+ default:
+ assert(info->type != info->type);
+ abort();
}
return -1;
}
diff --git a/sysdeps/linux-gnu/s390/trace.c b/sysdeps/linux-gnu/s390/trace.c
index 4f6eb8d..b9e05ff 100644
--- a/sysdeps/linux-gnu/s390/trace.c
+++ b/sysdeps/linux-gnu/s390/trace.c
@@ -209,9 +209,11 @@ arch_type_sizeof(struct Process *proc, struct arg_type_info *info)
case ARGTYPE_STRUCT:
/* Use default value. */
return (size_t)-2;
+
+ default:
+ assert(info->type != info->type);
+ abort();
}
- assert(info->type != info->type);
- abort();
}
size_t
@@ -221,8 +223,8 @@ arch_type_alignof(struct Process *proc, struct arg_type_info *info)
return (size_t)-2;
switch (info->type) {
- case ARGTYPE_VOID:
- assert(info->type != ARGTYPE_VOID);
+ default:
+ assert(info->type != info->type);
break;
case ARGTYPE_CHAR:
diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c
index cca1638..62a1696 100644
--- a/sysdeps/linux-gnu/x86/fetch.c
+++ b/sysdeps/linux-gnu/x86/fetch.c
@@ -499,6 +499,11 @@ classify(struct Process *proc, struct fetch_context *context,
done:
type_destroy(&flattened);
return ret;
+
+ default:
+ /* Unsupported type. */
+ assert(info->type != info->type);
+ abort();
}
abort();
}
@@ -619,8 +624,8 @@ arch_fetch_retval_32(struct fetch_context *context, enum tof type,
assert(cls == CLASS_X87);
return 0;
- case ARGTYPE_ARRAY:
case ARGTYPE_STRUCT: /* Handled above. */
+ default:
assert(!"Unexpected i386 retval type!");
abort();
}
diff --git a/sysdeps/linux-gnu/x86/trace.c b/sysdeps/linux-gnu/x86/trace.c
index cc1a6a1..0282ade 100644
--- a/sysdeps/linux-gnu/x86/trace.c
+++ b/sysdeps/linux-gnu/x86/trace.c
@@ -143,9 +143,11 @@ arch_type_sizeof(struct Process *proc, struct arg_type_info *info)
case ARGTYPE_STRUCT:
/* Use default value. */
return (size_t)-2;
+
+ default:
+ assert(info->type != info->type);
+ abort();
}
- assert(info->type != info->type);
- abort();
}
size_t
@@ -155,8 +157,9 @@ arch_type_alignof(struct Process *proc, struct arg_type_info *info)
return (size_t)-2;
switch (info->type) {
- case ARGTYPE_VOID:
- assert(info->type != ARGTYPE_VOID);
+ default:
+ assert(info->type != info->type);
+ abort();
break;
case ARGTYPE_CHAR:
@@ -185,5 +188,4 @@ arch_type_alignof(struct Process *proc, struct arg_type_info *info)
/* Use default value. */
return (size_t)-2;
}
- abort();
}
--
1.7.8.6
More information about the Ltrace-devel
mailing list