Network driver debugging

Hello,

I am trying to use Momentics to implement a network driver, but I just
wonder that how can I debug the driver. As I know, we need to run io-net
with some parameters or mount the network driver first, but how can I do
this from Momentic IDE (I am using Windows version). In other words, how can
I put a break point in network driver (devn-*.so) and debug the driver
remotely usin Momentics?

Any help is appreciated.

Regards,
Sharad

On Fri, Jun 30, 2006 at 03:39:15PM -0700, Shahrad wrote:

I am trying to use Momentics to implement a network driver, but I just
wonder that how can I debug the driver. As I know, we need to run io-net
with some parameters or mount the network driver first, but how can I do
this from Momentic IDE (I am using Windows version). In other words, how can
I put a break point in network driver (devn-*.so) and debug the driver
remotely usin Momentics?

I think if you create a project for your network driver, you can
probably drag the io-net binary into the same folder as the sources.
That way when you open up the debug window it should show up as a
binary, you can set it’s command line arguments to include “-ptcpip
-d/path/to/your/driver.so”. You can also have the IDE upload the newest
version of your driver dll to the target each time you start a new debug
sessions using the “download” tab in the debug configuration.

A second issue is how to actually remotely debug io-net. Your connection
to qconn on the target is normally done with TCP/IP, using io-net. So if
you set a breakpoint in io-net your debug session would stop. Ideally,
if you two network interfaces on the target (say one that you have a
driver for, and one that you are writing a driver for) you can use two
instances of io-net. One to give you the connection to the target, and
one to debug your new network driver. You can start different instances
using the “prefix” option to npm-tcpip.so. There should be more info in
the documentation for io-net and npm-tcpip.so.


Gilles

Thank you Gilles for reply,

I think the way is the same as you mentioned, but if I want to create new
instance of io-net, which can be done by “io-net -i1” then I need to hold
that processes and kind of attaching the debugger to it. It should be the
same way of graphic driver debugging.
So my questions are

  • How can I hold the new instance of “io-net”?
    I think it can be done by attaching to process while debugging the
    network driver and send stop signal from IDE … Any idea?

  • After holding io-net, how can I load the symbols of the current driver
    (while I don’t have a copy of the driver in target, because I use attach to
    process case for debugging)?

  • If all those goes correct then I should be able to make a break point in
    function (like net_init()) and continue debugging using IDE.

Shahrad

“Gilles Roy” <groy@qnx.com> wrote in message
news:20060705141257.GB20319@groy.ott.qnx.com

On Fri, Jun 30, 2006 at 03:39:15PM -0700, Shahrad wrote:
I am trying to use Momentics to implement a network driver, but I just
wonder that how can I debug the driver. As I know, we need to run io-net
with some parameters or mount the network driver first, but how can I do
this from Momentic IDE (I am using Windows version). In other words, how
can
I put a break point in network driver (devn-*.so) and debug the driver
remotely usin Momentics?


I think if you create a project for your network driver, you can
probably drag the io-net binary into the same folder as the sources.
That way when you open up the debug window it should show up as a
binary, you can set it’s command line arguments to include “-ptcpip
-d/path/to/your/driver.so”. You can also have the IDE upload the newest
version of your driver dll to the target each time you start a new debug
sessions using the “download” tab in the debug configuration.

A second issue is how to actually remotely debug io-net. Your connection
to qconn on the target is normally done with TCP/IP, using io-net. So if
you set a breakpoint in io-net your debug session would stop. Ideally,
if you two network interfaces on the target (say one that you have a
driver for, and one that you are writing a driver for) you can use two
instances of io-net. One to give you the connection to the target, and
one to debug your new network driver. You can start different instances
using the “prefix” option to npm-tcpip.so. There should be more info in
the documentation for io-net and npm-tcpip.so.


Gilles

On Thu, Jul 06, 2006 at 11:03:55AM -0700, Shahrad wrote:

I think the way is the same as you mentioned, but if I want to create new
instance of io-net, which can be done by “io-net -i1” then I need to hold
that processes and kind of attaching the debugger to it. It should be the
same way of graphic driver debugging.
So my questions are

  • How can I hold the new instance of “io-net”?
    I think it can be done by attaching to process while debugging the
    network driver and send stop signal from IDE … Any idea?

  • After holding io-net, how can I load the symbols of the current driver
    (while I don’t have a copy of the driver in target, because I use attach to
    process case for debugging)?

There are two methods you should be able to use:

  1. Attaching to an already running io-net

You should basically just be able to create a new Debug Configuration
(QNX attach to process w/QConn (IP)). As your application you should be
able to specify your driver dll (although it says “application”, this is
really the file you will be loading your debug symbols from). When you
click Debug, it will show you a list of running projects. There should
be two instances of io-net running (one for the qconn connection, one
which you will be debugging). Chose the io-net you want to mount your
network driver into. Then telnet to the target and mount your network
driver. If you have any breakpoints, it should hit them.

NOTE: For this approach, you have to get the new driver dll on the
target each time you change the code in the DLL (i.e. the IDE doesn’t
automatically transfer it to the target for you). If you want that look
at the second method below.


2) Launching io-net from your project

If you create a link from within your project workspace to the io-net
binary under $QNX_TARGET, io-net should show up a binary under your
project. Then you just just use a normal debug configuration, specify
io-net as the application you want to debug, give it the correct command
line arguments (e.g., -i 2 -p tcpip prefix=/alt -d yourdriverdll). You
can also specify under the download tab that you want your driver dll
downloaded every time. This way if you change something you can just
launch another debug session and it will automatically use your new
driver dll.


Hope this helps,
Gilles






  • If all those goes correct then I should be able to make a break point in
    function (like net_init()) and continue debugging using IDE.

Shahrad

“Gilles Roy” <> groy@qnx.com> > wrote in message
news:> 20060705141257.GB20319@groy.ott.qnx.com> …
On Fri, Jun 30, 2006 at 03:39:15PM -0700, Shahrad wrote:
I am trying to use Momentics to implement a network driver, but I just
wonder that how can I debug the driver. As I know, we need to run io-net
with some parameters or mount the network driver first, but how can I do
this from Momentic IDE (I am using Windows version). In other words, how
can
I put a break point in network driver (devn-*.so) and debug the driver
remotely usin Momentics?


I think if you create a project for your network driver, you can
probably drag the io-net binary into the same folder as the sources.
That way when you open up the debug window it should show up as a
binary, you can set it’s command line arguments to include “-ptcpip
-d/path/to/your/driver.so”. You can also have the IDE upload the newest
version of your driver dll to the target each time you start a new debug
sessions using the “download” tab in the debug configuration.

A second issue is how to actually remotely debug io-net. Your connection
to qconn on the target is normally done with TCP/IP, using io-net. So if
you set a breakpoint in io-net your debug session would stop. Ideally,
if you two network interfaces on the target (say one that you have a
driver for, and one that you are writing a driver for) you can use two
instances of io-net. One to give you the connection to the target, and
one to debug your new network driver. You can start different instances
using the “prefix” option to npm-tcpip.so. There should be more info in
the documentation for io-net and npm-tcpip.so.


Gilles