public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Michal Simek <monstr@monstr.eu>
Cc: John Williams <john.williams@petalogix.com>,
	"Edgar E. Iglesias" <edgar.iglesias@petalogix.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] microblaze: Add KGDB support
Date: Wed, 28 Jul 2010 06:58:59 -0500	[thread overview]
Message-ID: <4C501B83.9070400@windriver.com> (raw)
In-Reply-To: <1280309353-9172-2-git-send-email-monstr@monstr.eu>

On 07/28/2010 04:29 AM, Michal Simek wrote:
> Kgdb uses brki r16, 0x18 instruction to call
> low level _debug_exception function which save
> current state to pt_regs and call microblaze_kgdb_break
> function. _debug_exception should be called only from
> the kernel space. User space calling is not supported
> because user application debugging uses different handling.
>
> pt_regs_to_gdb_regs loads additional special registers
> which can't be changed
>
>  * Enable KGDB in Kconfig
>  * Remove ancient not-tested KGDB support
>  * Remove ancient _debug_exception code from entry.S
>
> Only MMU KGDB support is supported.
>
>   
There is only one place I saw a problem and if you fix it, you can add:

Acked-by: Jason Wessel <jason.wessel@windriver.com>

> +
> +int kgdb_arch_handle_exception(int vector, int signo, int err_code,
> +			       char *remcom_in_buffer, char *remcom_out_buffer,
> +			       struct pt_regs *regs)
> +{
> +	char *ptr;
> +	unsigned long address;
> +	int cpu = smp_processor_id();
> +
> +	switch (remcom_in_buffer[0]) {
> +	case 's':
> +	case 'c':
> +		/* handle the optional parameter */
> +		ptr = &remcom_in_buffer[1];
> +		if (kgdb_hex2long(&ptr, &address))
> +			regs->pc = address;
> +		atomic_set(&kgdb_cpu_doing_single_step, -1);
> +		if (remcom_in_buffer[0] == 's')
> +			atomic_set(&kgdb_cpu_doing_single_step, cpu);
> +
> +		return 0;
> +	}
>   

As far as I can see there is no code in the arch specific portion to
make use of single stepping.  It needs to be implemented using hardware
assist, or a software breakpoint strategy, else you simply omit the 's'
case from statement so that kdb will not enable single stepping at run time.

Example:

	switch (remcom_in_buffer[0]) {
	case 'c':
		/* handle the optional parameter */
		ptr = &remcom_in_buffer[1];
		if (kgdb_hex2long(&ptr, &address))
			regs->pc = address;

		return 0;
	}


You can also remove the kgdb_cpu_doing_single_step operations because
this arch does not currently implement the kgdb single stepping.


Cheers,
Jason.

  reply	other threads:[~2010-07-28 11:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1280309353-9172-1-git-send-email-monstr@monstr.eu>
2010-07-28  9:29 ` [PATCH] microblaze: Add KGDB support Michal Simek
2010-07-28 11:58   ` Jason Wessel [this message]
2010-07-28 11:58     ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C501B83.9070400@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=edgar.iglesias@petalogix.com \
    --cc=john.williams@petalogix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox