diff options
author | Edgar E. Iglesias <edgar@axis.com> | 2012-10-04 15:26:38 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-10-14 00:21:52 +0200 |
commit | 5b5c256d0e9076e745908a43acc46353265a5608 (patch) | |
tree | b56b366fbc00cdb3750fc925910eaa94bbf32e33 /sysdeps | |
parent | 3a8a91ca57f66d664b3fbd19882e6d163c7ad496 (diff) | |
download | ltrace-5b5c256d0e9076e745908a43acc46353265a5608.tar.gz |
Abort on unsupported value types in the backends
Makes it easier to add new types.
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/linux-gnu/ia64/fetch.c | 5 | ||||
-rw-r--r-- | sysdeps/linux-gnu/m68k/fetch.c | 2 | ||||
-rw-r--r-- | sysdeps/linux-gnu/ppc/fetch.c | 9 | ||||
-rw-r--r-- | sysdeps/linux-gnu/ppc/trace.c | 14 | ||||
-rw-r--r-- | sysdeps/linux-gnu/s390/fetch.c | 4 | ||||
-rw-r--r-- | sysdeps/linux-gnu/s390/trace.c | 10 | ||||
-rw-r--r-- | sysdeps/linux-gnu/x86/fetch.c | 7 | ||||
-rw-r--r-- | sysdeps/linux-gnu/x86/trace.c | 12 |
8 files changed, 37 insertions, 26 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/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c index 40c91d9..6e3bc1c 100644 --- a/sysdeps/linux-gnu/ppc/fetch.c +++ b/sysdeps/linux-gnu/ppc/fetch.c @@ -319,7 +319,8 @@ allocate_argument(struct fetch_context *ctx, struct Process *proc, case ARGTYPE_ARRAY: /* Arrays decay into pointers. XXX Fortran? */ - assert(info->type != ARGTYPE_ARRAY); + default: + assert(info->type != info->type); abort(); } @@ -370,11 +371,7 @@ allocate_argument(struct fetch_context *ctx, struct Process *proc, /* Small values need post-processing. */ if (sz < width) { switch (info->type) { - case ARGTYPE_LONG: - case ARGTYPE_ULONG: - case ARGTYPE_POINTER: - case ARGTYPE_DOUBLE: - case ARGTYPE_VOID: + default: abort(); /* Simple integer types (char, short, int, long, enum) diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c index 2bb317f..50b870d 100644 --- a/sysdeps/linux-gnu/ppc/trace.c +++ b/sysdeps/linux-gnu/ppc/trace.c @@ -224,9 +224,12 @@ 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(); + break; } - assert(info->type != info->type); - abort(); } size_t @@ -236,8 +239,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: @@ -259,6 +263,4 @@ arch_type_alignof(struct Process *proc, struct arg_type_info *info) /* Use default value. */ return (size_t)-2; } - assert(info->type != info->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(); } |