public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* GDB/Insight bug: nexti for target ARM-ELF
@ 2006-11-23  8:40 Guillaume Savaton
  2006-12-01  2:22 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Guillaume Savaton @ 2006-11-23  8:40 UTC (permalink / raw)
  To: insight

Hi,

I am using Insight 6.5.0 as a cross-debugger for ARM-ELF targets (Host is a PC 
running Debian Etch).

I am trying to run a simple program written (by me) in assembly language.
The executable has been generated using GNU AS and LD.

When running my program step by step:
- command 'stepi' works as expected
- command 'nexti' works as expected for all instructions except subprogram calls

Instead of stepping over subprogram calls, 'nexti' makes GDB hang and the only 
way to stop is to kill it.

The contents of the called subprogram seem to be significant: when adding dummy 
instructions at the beginning of my subprogram, 'nexti' works again as expected.

Moreover, the problem does not occur when debugging programs written in C.

The bug has been observed with these targets:
- built-in ARM simulator (target sim)
- remote/tcp target using the in-circuit emulator BDI2000 with an ARM7TDMI 
development board.

The same behavior has been observed with the command-line interface and the GUI.

I have just sent a bug report to GDB developers, but I am wondering whether this 
bug may be related to insight.

Did anyone experience the same problem?

Best regards,

-- 
Guillaume Savaton

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB/Insight bug: nexti for target ARM-ELF
  2006-11-23  8:40 GDB/Insight bug: nexti for target ARM-ELF Guillaume Savaton
@ 2006-12-01  2:22 ` Keith Seitz
  2006-12-01  8:04   ` Guillaume Savaton
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2006-12-01  2:22 UTC (permalink / raw)
  To: Guillaume Savaton; +Cc: insight

Guillaume Savaton wrote:

> The same behavior has been observed with the command-line interface and 
> the GUI.

Wow, good work! I had already written a message suggesting that you try 
it with command-line gdb, but you've already done that. Usually these 
exec-related problems in insight are gdb problems, since Insight 
practically just does the equivalent of typing at gdb with this stuff.

Unfortunately my experience with gdb/insight has been limited to x86 
linux for many years now, and gdb has changed rapidly since I last 
hacked on it. I will say this, though: one must be *very* careful about 
hand-coding assembler and trying to use it in a source debugger like 
gdb. Gdb must be able to recognize the boundaries of your 
"functions"/subprograms. In other words, they must look pretty C-like.

At one time, this used to mean that in order to debug, you had to write 
function prologues which gdb could parse. One thing to try (for the heck 
of it) is different debug info formats (you are telling the *assembler* 
to include debug info? "as -gFORMAT" or "gcc -Wa,-gFORMAT"). At one 
time, gdb was much better at dealing with assembler using stabs.

Good luck,
Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB/Insight bug: nexti for target ARM-ELF
  2006-12-01  2:22 ` Keith Seitz
@ 2006-12-01  8:04   ` Guillaume Savaton
  2006-12-01 17:57     ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Guillaume Savaton @ 2006-12-01  8:04 UTC (permalink / raw)
  Cc: insight

Keith Seitz a écrit :
> Usually these exec-related problems in insight are gdb problems,

Yes, that's why I sent a bug report to the GDB project.

I tried to compare different versions :
- nexti worked fine in insight 6.10 for arm-elf
- in a recent weekly build of insight 6.5.50, it worked almost correctly

By 'almost', I mean that nexti sometimes fails when trying to step over a branch 
instruction.
I guess nexti should behave like stepi when the current instruction is not a 
subprogram call ?

> Gdb must be able to recognize the boundaries of your 
> "functions"/subprograms. In other words, they must look pretty C-like.

I did not find a relevant pattern here : I tried to compare hand-written asm 
with code generated by GCC.
With optimizations (-O2), the generated code is very close to my hand written asm.

My experiments show that adding dummy instructions at the beginning of a 
hand-written asm subprogram can make nexti work, but I could not find a relevant 
pattern.

> One thing to try (for the heck of it) is different debug info formats

I already tried invoking AS with '-g' or '-gstabs' ... same behavior.

Well : do you think it is safe for me to switch to the latest CVS version of 
insight ?
Last time I tried, the "target settings" dialog didn't work, but I see that this 
has been solved.

Thanks,

-- 
Guillaume Savaton

----------------------------
ESEO
4, rue Merlet de la Boulaye - BP 30926
49009 Angers Cedex 01
France

Tél (ligne directe) : +33(0)2.41.86.67.60
Tél (accueil) : +33(0)2.41.86.67.67
Fax : +33(0)2.41.87.99.27

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB/Insight bug: nexti for target ARM-ELF
  2006-12-01  8:04   ` Guillaume Savaton
@ 2006-12-01 17:57     ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2006-12-01 17:57 UTC (permalink / raw)
  To: Guillaume Savaton; +Cc: insight

Guillaume Savaton wrote:

> Well : do you think it is safe for me to switch to the latest CVS 
> version of insight ?
> Last time I tried, the "target settings" dialog didn't work, but I see 
> that this has been solved.

It is usually safe. Like gdb, I try to keep insight HEAD stable and 
building. I didn't know that the target selection dialog was broken 
until I attempted to investigate another bug. Since I only use x86 linux 
nowadays (very, very seldom x86 cygwin), I never really use the target 
selection dialog.

Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-01 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-23  8:40 GDB/Insight bug: nexti for target ARM-ELF Guillaume Savaton
2006-12-01  2:22 ` Keith Seitz
2006-12-01  8:04   ` Guillaume Savaton
2006-12-01 17:57     ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).