Re: [3/6] kgdb: core

From: Jan Kiszka
Date: Sun Feb 10 2008 - 08:37:09 EST


Marcin Slusarz wrote:
> On Sun, Feb 10, 2008 at 08:13:31AM +0100, Ingo Molnar wrote:
>> + } else {
>> + while (count-- > 0) {
>> + unsigned char ch;
>> +
>> + if (probe_kernel_address(mem, ch)) {
>> + kgdb_may_fault = 0;
>> + return ERR_PTR(-EINVAL);
>> + }
>> + mem++;
>> + *buf++ = hexchars[ch >> 4];
>> + *buf++ = hexchars[ch & 0xf];
> use pack_hex_byte?

Good point! kgdb introduces this helper but don't use it consequently!

>> +/*
>> + * While we find nice hex chars, build a long_val.
>> + * Return number of chars processed.
>> + */
>> +int kgdb_hex2long(char **ptr, long *long_val)
>> +{
>> + int hex_val;
>> + int num = 0;
>> +
>> + *long_val = 0;
>> +
>> + while (**ptr) {
>> + hex_val = hex(**ptr);
>> + if (hex_val >= 0) {
>> + *long_val = (*long_val << 4) | hex_val;
>> + num++;
>> + } else
>> + break;
>> +
>> + (*ptr)++;
>> + }
> if (hex_val < 0)
> break;
> *long_val = (*long_val << 4) | hex_val;
> num++;
> (*ptr)++;

Jep, will include this in the cleanup patch I'm currently baking.

Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/