* gdb stub implement questions @ 2008-09-01 4:03 Michael Qiu 2008-09-01 4:11 ` Daniel Jacobowitz 0 siblings, 1 reply; 5+ messages in thread From: Michael Qiu @ 2008-09-01 4:03 UTC (permalink / raw) To: gdb Hi Guys, I'm using ucos/ii and an r3k like mips core for my project. I'm going to add a gdb-stub on my target. But I still have some uncleared questions, can anyone give me a hand? 1. Is there any hardware requirement for the gdb-stub running correctly? e.g. special instructions? Currently, my core only support "bkpt". Is it enough? 2. I'v read the gdb-stub from yamon, but it seems only work for a bootloader. There is no multitask. The yamon shell in charge of the context switch, but it only a ping-pang like switch. How can I support multitask in ucos/ii? 3. In general, the gdb-stub should be implemented in a bootloader or in OS level, or user spaces? Best regards ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdb stub implement questions 2008-09-01 4:03 gdb stub implement questions Michael Qiu @ 2008-09-01 4:11 ` Daniel Jacobowitz 2008-09-01 6:09 ` Michael Qiu 0 siblings, 1 reply; 5+ messages in thread From: Daniel Jacobowitz @ 2008-09-01 4:11 UTC (permalink / raw) To: Michael Qiu; +Cc: gdb On Mon, Sep 01, 2008 at 12:02:38PM +0800, Michael Qiu wrote: > Hi Guys, > I'm using ucos/ii and an r3k like mips core for my project. I'm > going to add a gdb-stub on my target. But I still have some uncleared > questions, can anyone give me a hand? > > 1. Is there any hardware requirement for the gdb-stub running > correctly? e.g. special instructions? Currently, my core only support > "bkpt". Is it enough? Yes, that's probably enough. > 2. I'v read the gdb-stub from yamon, but it seems only work for a > bootloader. There is no multitask. The yamon shell in charge of the > context switch, but it only a ping-pang like switch. How can I support > multitask in ucos/ii? > > 3. In general, the gdb-stub should be implemented in a bootloader or > in OS level, or user spaces? Sorry, the answer to these are both 'it depends'. These are more questions about your operating system than about GDB. You probably want to model each task as a 'thread' to gdb. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdb stub implement questions 2008-09-01 4:11 ` Daniel Jacobowitz @ 2008-09-01 6:09 ` Michael Qiu 2008-09-01 6:32 ` Michael Qiu 2008-09-01 8:22 ` Wenbo Yang 0 siblings, 2 replies; 5+ messages in thread From: Michael Qiu @ 2008-09-01 6:09 UTC (permalink / raw) To: Michael Qiu, gdb Here I have an proposal, will you take a look? Background: I'm using uscosII, it's a multitask os, and all tasks running in the same memory space. So it's easy to get other tasks' information. What I suppose to do is: 1. When system startup. I will put a piece of code like this: install_bkpt_handle(); // Install the trap handler for gdb. bkpt; // Just trigger it. Question: Can I just put it before OS start? If I just put it after OS has started, then only means I cannot debug the os startup process? 2. Write an exception handler to handle the bkpt exception. In this routine I should save the context of interrupt task and swith to a gdb remote debug protocal process task. Question: should I disable interrupt in the exception handler and the protocal process task? Or should I disable task scheduler when enter the protocal process task? 3. When user just "continue" or "step" the program, the protocal process task should save it's context and restore the cpu with the previous saved context for the interrupt task. Question: How can I do it with ucos/II's API without digging into the code? Should the protocal process task action like an normal task or just an routine not known to OS? Thanks in advance. 2008/9/1, Daniel Jacobowitz <drow@false.org>: > On Mon, Sep 01, 2008 at 12:02:38PM +0800, Michael Qiu wrote: > > Hi Guys, > > I'm using ucos/ii and an r3k like mips core for my project. I'm > > going to add a gdb-stub on my target. But I still have some uncleared > > questions, can anyone give me a hand? > > > > 1. Is there any hardware requirement for the gdb-stub running > > correctly? e.g. special instructions? Currently, my core only support > > "bkpt". Is it enough? > > Yes, that's probably enough. > > > 2. I'v read the gdb-stub from yamon, but it seems only work for a > > bootloader. There is no multitask. The yamon shell in charge of the > > context switch, but it only a ping-pang like switch. How can I support > > multitask in ucos/ii? > > > > 3. In general, the gdb-stub should be implemented in a bootloader or > > in OS level, or user spaces? > > Sorry, the answer to these are both 'it depends'. These are more > questions about your operating system than about GDB. > > You probably want to model each task as a 'thread' to gdb. > > -- > Daniel Jacobowitz > CodeSourcery > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdb stub implement questions 2008-09-01 6:09 ` Michael Qiu @ 2008-09-01 6:32 ` Michael Qiu 2008-09-01 8:22 ` Wenbo Yang 1 sibling, 0 replies; 5+ messages in thread From: Michael Qiu @ 2008-09-01 6:32 UTC (permalink / raw) To: Michael Qiu, gdb 2008/9/1, Michael Qiu <fallwind@gmail.com>: > Here I have an proposal, will you take a look? > > Background: > I'm using uscosII, it's a multitask os, and all tasks running in the > same memory space. So it's easy to get other tasks' information. > > What I suppose to do is: > 1. When system startup. I will put a piece of code like this: > install_bkpt_handle(); // Install the trap handler for gdb. > bkpt; // Just trigger it. > Question: Can I just put it before OS start? If I just put it after OS > has started, then only means I cannot debug the os startup process? It seems a stupid question. When the OS isn't running, there is no idea of tasks and codes're running in a temp stack. It looks if I want to debug OS, I should always doing some work in OS level. > > 2. Write an exception handler to handle the bkpt exception. In this > routine I should save the context of interrupt task and swith to a gdb > remote debug protocal process task. > Question: should I disable interrupt in the exception handler and the > protocal process task? Or should I disable task scheduler when enter > the protocal process task? > > 3. When user just "continue" or "step" the program, the protocal > process task should save it's context and restore the cpu with the > previous saved context for the interrupt task. > Question: How can I do it with ucos/II's API without digging into the > code? Should the protocal process task action like an normal task or > just an routine not known to OS? > > Thanks in advance. > > 2008/9/1, Daniel Jacobowitz <drow@false.org>: > > On Mon, Sep 01, 2008 at 12:02:38PM +0800, Michael Qiu wrote: > > > Hi Guys, > > > I'm using ucos/ii and an r3k like mips core for my project. I'm > > > going to add a gdb-stub on my target. But I still have some uncleared > > > questions, can anyone give me a hand? > > > > > > 1. Is there any hardware requirement for the gdb-stub running > > > correctly? e.g. special instructions? Currently, my core only support > > > "bkpt". Is it enough? > > > > Yes, that's probably enough. > > > > > 2. I'v read the gdb-stub from yamon, but it seems only work for a > > > bootloader. There is no multitask. The yamon shell in charge of the > > > context switch, but it only a ping-pang like switch. How can I support > > > multitask in ucos/ii? > > > > > > 3. In general, the gdb-stub should be implemented in a bootloader or > > > in OS level, or user spaces? > > > > Sorry, the answer to these are both 'it depends'. These are more > > questions about your operating system than about GDB. > > > > You probably want to model each task as a 'thread' to gdb. > > > > -- > > Daniel Jacobowitz > > CodeSourcery > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: gdb stub implement questions 2008-09-01 6:09 ` Michael Qiu 2008-09-01 6:32 ` Michael Qiu @ 2008-09-01 8:22 ` Wenbo Yang 1 sibling, 0 replies; 5+ messages in thread From: Wenbo Yang @ 2008-09-01 8:22 UTC (permalink / raw) To: Michael Qiu; +Cc: gdb Michael Qiu wrote: > Here I have an proposal, will you take a look? > > Background: > I'm using uscosII, it's a multitask os, and all tasks running in the > same memory space. So it's easy to get other tasks' information. > > What I suppose to do is: > 1. When system startup. I will put a piece of code like this: > install_bkpt_handle(); // Install the trap handler for gdb. > bkpt; // Just trigger it. > Question: Can I just put it before OS start? If I just put it after OS > has started, then only means I cannot debug the os startup process? > Yes, you can debug the os startup process. Just put the stub in different memory space against your os. > 2. Write an exception handler to handle the bkpt exception. In this > routine I should save the context of interrupt task and swith to a gdb > remote debug protocal process task. > Question: should I disable interrupt in the exception handler and the > protocal process task? Or should I disable task scheduler when enter > the protocal process task? > Maybe you made some mistake here. If you were debugging an OS, probably the task scheduler is meaningless to you. If you were debugging an APP on an os, it is your os's responsibility to support stub's function. > 3. When user just "continue" or "step" the program, the protocal > process task should save it's context and restore the cpu with the > previous saved context for the interrupt task. > Question: How can I do it with ucos/II's API without digging into the > code? Should the protocal process task action like an normal task or > just an routine not known to OS? > Still Daniel's answer: These are more questions about your operating system than about GDB. Regards, Wenbo -- Wenbo YANG The State Key Laboratory Of Information Security Graduate University of CAS, 19A Yuquan Road, Beijing, China MSN/AIM/QQ: solrex@live.com --- Homepage: http://solrex.cn ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-01 8:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-09-01 4:03 gdb stub implement questions Michael Qiu 2008-09-01 4:11 ` Daniel Jacobowitz 2008-09-01 6:09 ` Michael Qiu 2008-09-01 6:32 ` Michael Qiu 2008-09-01 8:22 ` Wenbo Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox