lkml.org 
[lkml]   [2008]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [3/6] kgdb: core
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


\
 
 \ /
  Last update: 2008-02-10 14:39    [W:0.147 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site