diff options
author | Guy Harris <guy@alum.mit.edu> | 2005-01-16 23:30:55 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2005-01-16 23:30:55 +0000 |
commit | 2bdef3c1229d5c492c0e574135b3ef4589647b2a (patch) | |
tree | 598e354d8cb4cd7006ea802dd45aa74e027b5454 /epan/dissectors/packet-frame.c | |
parent | 13bf5539af20a4c372bbcb58c0a0f8d051ab3dbc (diff) |
Rename the FieldError exception to DissectorError.
Add a DISSECTOR_ASSERT() macro, which is the usual type of assertion
macro, but throws a DissectorError exception with a message giving the
flien and line number and the failed test as a string. Use that macro
in "alloc_field_info()".
Report that exception in the Info column and the protocol tree, as well
as logging the exception failure with g_warning().
svn path=/trunk/; revision=13078
Diffstat (limited to 'epan/dissectors/packet-frame.c')
-rw-r--r-- | epan/dissectors/packet-frame.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 0716595f72..e80ce51eda 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -220,18 +220,23 @@ show_exception(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, case ReportedBoundsError: show_reported_bounds_error(tvb, pinfo, tree); break; - case FieldError: + + case DissectorError: if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, "[Dissector Bug]"); + col_append_fstr(pinfo->cinfo, COL_INFO, + "[Dissector bug, protocol %s: %s]", + pinfo->current_proto, exception_message); proto_tree_add_protocol_format(tree, proto_malformed, tvb, 0, 0, - "[FieldError: %s]", exception_message); - g_warning("FieldError in packet: %u (%s)", pinfo->fd->num, exception_message); - if(exception_message) - g_free( (void *) exception_message); - break; - default: - /* XXX - we want to know, if an unknown exception passed until here, don't we? */ - g_assert_not_reached(); + "[Dissector bug, protocol %s: %s]", + pinfo->current_proto, exception_message); + g_warning("Dissector bug, protocol %s, in packet %u: %s", + pinfo->current_proto, pinfo->fd->num, exception_message); + g_free((void *)exception_message); + break; + + default: + /* XXX - we want to know, if an unknown exception passed until here, don't we? */ + g_assert_not_reached(); } } |