freebsd-nq/sys/ddb
John Baldwin ecb65f66c6 Use casts to force an unsigned comparison in db_search_symbol().
On all of our platforms, db_expr_t is a signed integer while
db_addr_t is an unsigned integer value.  db_search_symbol used variables
of type db_expr_t to hold the current offset of the requested address from
the "best" symbol found so far.  This value was initialized to '~0'.
When a new symbol is found from a symbol table, the associated diff for the
new symbol is compared against the existing value as 'if (newdiff < diff)'
to determine if the new symbol had a smaller diff and was thus a closer
match.

On 64-bit MIPS, the '~0' was treated as a negative value (-1).  A lookup
that found a perfect match of an address against a symbol returned a diff
of 0.  However, in signed comparisons, 0 is not less than -1.  As a result,
DDB on 64-bit MIPS never resolved any addresses to symbols.  Workaround
this by using casts to force an unsigned comparison.

Probably the diff returned from db_search_symbol() and X_db_search_symbol()
should be changed to a db_addr_t instead of a db_expr_t as it is an
unsigned value (and is an offset of an address, so should fit in the same
size as an address).

Sponsored by:	DARPA / AFRL
2016-12-14 00:18:12 +00:00
..
db_access.c
db_access.h
db_break.c
db_break.h
db_capture.c
db_command.c Correct the type of db_cmd_loop_done. 2016-09-09 04:16:53 +00:00
db_command.h
db_examine.c Determine the operand/address size of %cs in a new function 2016-09-25 16:30:29 +00:00
db_expr.c Expand error messages: print symbol names, parentheses and shift tokens, 2016-08-28 19:33:09 +00:00
db_input.c
db_lex.c
db_lex.h
db_main.c Pass the trap type and code down from db_trap() to db_stop_at_pc() so 2016-09-09 15:53:42 +00:00
db_output.c
db_output.h
db_print.c
db_ps.c In ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and 2016-08-14 15:26:40 +00:00
db_run.c Silently ignore unexpected single-step traps (except for turning 2016-09-17 11:43:51 +00:00
db_script.c
db_sym.c Use casts to force an unsigned comparison in db_search_symbol(). 2016-12-14 00:18:12 +00:00
db_sym.h
db_textdump.c Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
db_thread.c
db_variables.c
db_variables.h
db_watch.c
db_watch.h
db_write_cmd.c
ddb.h Pass the trap type and code down from db_trap() to db_stop_at_pc() so 2016-09-09 15:53:42 +00:00