Debugging Network Drivers

Hello All,
I’m trying to write a new network driver under QNX6.2.1B. Unfortunately the
documentation does not include any information about how one would go about
debugging a network driver. What I need to do is to startup io-net and have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <ali.ghorashi.remove_this@lmco.com> wrote in message
news:bf9dme$2jd$1@inn.qnx.com

Hello All,
I’m trying to write a new network driver under QNX6.2.1B. Unfortunately
the
documentation does not include any information about how one would go
about
debugging a network driver. What I need to do is to startup io-net and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali

Thanks for the response, I have a couple of problems:

  1. I need to debug my init function. Right now it crashes io-net and I don’t
    know why. So by the time I launch the debugger, the problem is gone.
  2. I would like to use Momentics to remotely debug and develop my driver. I
    haven’t used gdb before but I’ll learn if it is the only way to solve my
    problem.

Thanks,
-Ali

“Sreekanth” <nospam@nospam.com> wrote in message
news:bffrc2$gvh$1@inn.qnx.com

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach <io-net process id
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bf9dme$2jd$> 1@inn.qnx.com> …
Hello All,
I’m trying to write a new network driver under QNX6.2.1B. Unfortunately
the
documentation does not include any information about how one would go
about
debugging a network driver. What I need to do is to startup io-net and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali
\

To debug the start-up problems, there is a way but it is kind of painful.

  1. Start the io-net process.
  2. start the GDB (in a different shell)
  3. Put a break point in dl_open function (b dl_open).Don’t worry about
    source code of dl_open.You don’t need it.
  4. mount your driver(from the first shell)
  5. single step till your driver is loaded in memory( if you type
    sharedLibrary you should see your driver listed).
  6. Now list your code and add breakpoint wherever you need
  7. continue.
    :sunglasses: You should hit the break point as soon as you continue.
    Remember if more than one driver is being loaded (For e.g., if you are
    loading your driver like this io-net -d blah.so -p tcpip.so).You need to
    continue step 5 till your driver is loaded

Do you mean DDD when you say momentics ? It is kind of a pain in the neck to
use DDB to debug io-net.I have never succeed in using the DDD for debugging
io-net driver.Main issue i see is that i cannot attach to a process (which
is already running) from DDD But hey it is still easier to use gdb compared
to using Assembly level debuggers like in freebsd.


Hope it helps,

Sreekanth


“Ali Ghorashi” <ali.ghorashi.remove_this@lmco.com> wrote in message
news:bfh7ca$j6s$1@inn.qnx.com

Thanks for the response, I have a couple of problems:

  1. I need to debug my init function. Right now it crashes io-net and I
    don’t
    know why. So by the time I launch the debugger, the problem is gone.
  2. I would like to use Momentics to remotely debug and develop my driver.
    I
    haven’t used gdb before but I’ll learn if it is the only way to solve my
    problem.

Thanks,
-Ali

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:bffrc2$gvh$> 1@inn.qnx.com> …

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach <io-net process id
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bf9dme$2jd$> 1@inn.qnx.com> …
Hello All,
I’m trying to write a new network driver under QNX6.2.1B.
Unfortunately
the
documentation does not include any information about how one would go
about
debugging a network driver. What I need to do is to startup io-net and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali


\

One correction.You should break in dl_sym(Not in dl_open).Run SharedLibrary
every time the break point hits.This way you don’t have to single step the
function in assembly.

Sreekanth

“Sreekanth” <nospam@nospam.com> wrote in message
news:bfi2gd$7na$1@inn.qnx.com

To debug the start-up problems, there is a way but it is kind of painful.

  1. Start the io-net process.
  2. start the GDB (in a different shell)
  3. Put a break point in dl_open function (b dl_open).Don’t worry about
    source code of dl_open.You don’t need it.
  4. mount your driver(from the first shell)
  5. single step till your driver is loaded in memory( if you type
    sharedLibrary you should see your driver listed).
  6. Now list your code and add breakpoint wherever you need
  7. continue.
    :sunglasses: > You should hit the break point as soon as you continue.
    Remember if more than one driver is being loaded (For e.g., if you are
    loading your driver like this io-net -d blah.so -p tcpip.so).You need to
    continue step 5 till your driver is loaded

Do you mean DDD when you say momentics ? It is kind of a pain in the neck
to
use DDB to debug io-net.I have never succeed in using the DDD for
debugging
io-net driver.Main issue i see is that i cannot attach to a process (which
is already running) from DDD But hey it is still easier to use gdb
compared
to using Assembly level debuggers like in freebsd.


Hope it helps,

Sreekanth


“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bfh7ca$j6s$> 1@inn.qnx.com> …
Thanks for the response, I have a couple of problems:

  1. I need to debug my init function. Right now it crashes io-net and I
    don’t
    know why. So by the time I launch the debugger, the problem is gone.
  2. I would like to use Momentics to remotely debug and develop my
    driver.
    I
    haven’t used gdb before but I’ll learn if it is the only way to solve my
    problem.

Thanks,
-Ali

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:bffrc2$gvh$> 1@inn.qnx.com> …

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach <io-net process id
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bf9dme$2jd$> 1@inn.qnx.com> …
Hello All,
I’m trying to write a new network driver under QNX6.2.1B.
Unfortunately
the
documentation does not include any information about how one would
go
about
debugging a network driver. What I need to do is to startup io-net
and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali




\

Sreekanth,
Thanks for you response. By “Momentics” I meant the IDE that comes with the
professional version of QNX. I also found your thread regarding this
subject from 8-19-2002 which also helped me a great deal. I was trying to do
remote debugging because my target is an SBC with about 16M of flash IDE
space. Needless to say, I’m not running a full version of QNX on the target.
To make matters worse, I don’t know much about the GDB command line
interface… I guess I’m going to have to learn:).

Thanks for you help… I think I know where to go from here.

-Ali

“Sreekanth” <nospam@nospam.com> wrote in message
news:bfi2gd$7na$1@inn.qnx.com

To debug the start-up problems, there is a way but it is kind of painful.

  1. Start the io-net process.
  2. start the GDB (in a different shell)
  3. Put a break point in dl_open function (b dl_open).Don’t worry about
    source code of dl_open.You don’t need it.
  4. mount your driver(from the first shell)
  5. single step till your driver is loaded in memory( if you type
    sharedLibrary you should see your driver listed).
  6. Now list your code and add breakpoint wherever you need
  7. continue.
    :sunglasses: > You should hit the break point as soon as you continue.
    Remember if more than one driver is being loaded (For e.g., if you are
    loading your driver like this io-net -d blah.so -p tcpip.so).You need to
    continue step 5 till your driver is loaded

Do you mean DDD when you say momentics ? It is kind of a pain in the neck
to
use DDB to debug io-net.I have never succeed in using the DDD for
debugging
io-net driver.Main issue i see is that i cannot attach to a process (which
is already running) from DDD But hey it is still easier to use gdb
compared
to using Assembly level debuggers like in freebsd.


Hope it helps,

Sreekanth


“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bfh7ca$j6s$> 1@inn.qnx.com> …
Thanks for the response, I have a couple of problems:

  1. I need to debug my init function. Right now it crashes io-net and I
    don’t
    know why. So by the time I launch the debugger, the problem is gone.
  2. I would like to use Momentics to remotely debug and develop my
    driver.
    I
    haven’t used gdb before but I’ll learn if it is the only way to solve my
    problem.

Thanks,
-Ali

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:bffrc2$gvh$> 1@inn.qnx.com> …

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach <io-net process id
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bf9dme$2jd$> 1@inn.qnx.com> …
Hello All,
I’m trying to write a new network driver under QNX6.2.1B.
Unfortunately
the
documentation does not include any information about how one would
go
about
debugging a network driver. What I need to do is to startup io-net
and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali




\

Well for that kind of application you can always go for Serial GDB.I tried
it successfully sometime back

Sreekanth

“Ali Ghorashi” <ali.ghorashi.remove_this@lmco.com> wrote in message
news:bfjgr4$aqj$1@inn.qnx.com

Sreekanth,
Thanks for you response. By “Momentics” I meant the IDE that comes with
the
professional version of QNX. I also found your thread regarding this
subject from 8-19-2002 which also helped me a great deal. I was trying to
do
remote debugging because my target is an SBC with about 16M of flash IDE
space. Needless to say, I’m not running a full version of QNX on the
target.
To make matters worse, I don’t know much about the GDB command line
interface… I guess I’m going to have to learn:).

Thanks for you help… I think I know where to go from here.

-Ali

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:bfi2gd$7na$> 1@inn.qnx.com> …
To debug the start-up problems, there is a way but it is kind of
painful.

  1. Start the io-net process.
  2. start the GDB (in a different shell)
  3. Put a break point in dl_open function (b dl_open).Don’t worry about
    source code of dl_open.You don’t need it.
  4. mount your driver(from the first shell)
  5. single step till your driver is loaded in memory( if you type
    sharedLibrary you should see your driver listed).
  6. Now list your code and add breakpoint wherever you need
  7. continue.
    :sunglasses: > You should hit the break point as soon as you continue.
    Remember if more than one driver is being loaded (For e.g., if you are
    loading your driver like this io-net -d blah.so -p tcpip.so).You need
    to
    continue step 5 till your driver is loaded

Do you mean DDD when you say momentics ? It is kind of a pain in the
neck
to
use DDB to debug io-net.I have never succeed in using the DDD for
debugging
io-net driver.Main issue i see is that i cannot attach to a process
(which
is already running) from DDD But hey it is still easier to use gdb
compared
to using Assembly level debuggers like in freebsd.


Hope it helps,

Sreekanth


“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bfh7ca$j6s$> 1@inn.qnx.com> …
Thanks for the response, I have a couple of problems:

  1. I need to debug my init function. Right now it crashes io-net and I
    don’t
    know why. So by the time I launch the debugger, the problem is gone.
  2. I would like to use Momentics to remotely debug and develop my
    driver.
    I
    haven’t used gdb before but I’ll learn if it is the only way to solve
    my
    problem.

Thanks,
-Ali

“Sreekanth” <> nospam@nospam.com> > wrote in message
news:bffrc2$gvh$> 1@inn.qnx.com> …

  1. Compile your driver with symbols(With -g option)
  2. Start Io-net.
  3. Mount your driver
  4. start gdb
  5. attach <io-net process id
    Then debug like you would debug any application

Hope this helps

Sreekanth

“Ali Ghorashi” <> ali.ghorashi.remove_this@lmco.com> > wrote in message
news:bf9dme$2jd$> 1@inn.qnx.com> …
Hello All,
I’m trying to write a new network driver under QNX6.2.1B.
Unfortunately
the
documentation does not include any information about how one would
go
about
debugging a network driver. What I need to do is to startup io-net
and
have
the debugger stop in my devn-blah.so code.

Any Ideas?

-Ali






\