This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] btrace: support 32-bit inferior on 64-bit host


On 02/09/2015 09:12 AM, Markus Metzger wrote:
> The heuristic for filtering out kernel addressess in BTS trace checks the

Typo: Addresses.

> most significant bit in each address.  This works fine for 32-bit and 64-bit
> mode.
> 
> For 32-bit compatibility mode, i.e. a 32-bit inferior running on 64-bit
> host, we need to check bit 63 (or any bit bigger than 31), not bit 31.
> 
> Use the machine field in struct utsname provided by a uname call to
> determine whether we are running on a 64-bit host.

Does this correctly handle the case of 32-bit GDB on 64-bit system
debugging _32-bit_ inferior?  Based on e.g..

 $ uname -m
 x86_64
 $ i386 uname -m
 i686

I'd guess "no".

If I'm right, maybe a better heuristic for kernel bitness would be to look
for long mode in cpuid?  I.e., if we're running on a 64-bit CPU.
32-bit kernels on 64-bit CPUs are a dying breed, I think...

> @@ -102,6 +103,32 @@ perf_event_new_data (const struct perf_event_buffer *pev)
>    return *pev->data_head != pev->last_head;
>  }
>  
> +/* Try to determine the size of a pointer in bits for the OS.
> + *
> + * This is the same as the size of a pointer for the inferior process
> + * except when a 32-bit inferior is running on a 64-bit OS.
> + */

Wrong comment format.

> +
> +static int
> +linux_determine_ptr_bits (void)

Please name this something that indicates "ptr_bits of who".
E.g., linux_determine_host_ptr_bits or linux_determine_kernel_ptr_bits.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]