This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: cyg_io_lookup for /dev/tty0 fails


> The "problematic" statement is at address 103590.
> The corresponding source code is:
> ..cut
>          if (cyg_io_compare(name, t->name, &name_ptr)) {
>              // FUTURE: Check 'avail'/'online' here
>              if (t->dep_name) {
>                  res = cyg_io_lookup(t->dep_name, &stunion.h);
>                  if (res != ENOERR) {
>                      return res;
>                  }
>              } else {
>                  stunion.st = NULL;
>              }
> cut..
> 
> t->dep_name is not zero (see debugger screenshot) and hence the line
> res =
> cyg_io_lookup... should be invoked. I am not an ARM-assembler guru and
> hence I do not see what's wrong, bhe problem seems to be the code
> sequence
> starting at 1035B8. That's were it jumps to from 103594 - upon return
> from
> cyg_io_compare. What do you think about this?

Hi Robert,

The first thing I need to ask is whether you're building this with
optimizations on or not.  If you are, I would try building w/o optimization
turned on and see if the behavior remains the same.

To answer your earlier question, yes, GDB does have a disassembler built into
it, and you can use it wherever you like.
Basic use is simple:

(gdb) disassemble <function name>

or

(gdb) disassemble <start address> <end address>

You can also do things like:

(gdb) disassemble $pc $pc + 0x100

If you would like to see from the current program counter to + 0x100 for
example.

Next, in terms of being able to debug running code in terms of stepping
single instructions, there are a few ways.
A sure fire way is:

(gdb) disp/i $pc
1: x/i $pc
(gdb) stepi

The 'disp/i $pc' will show each instruction executed, and 'stepi' will step a
single instruction at a time.  If you want to turn this off, you can just
'undisp' the number of that display (in this case, 1) or 'undisp' by itself
will clear all current display events.

--Chris

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