bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fixing gdb


From: jacob navia
Subject: fixing gdb
Date: Sun, 19 Dec 2004 20:32:15 +0100
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Dear Friends:

I reported recently a bug in gdb for amd64. It will not display any
local variables if you use the stabs debug info.

Fix:
This bug disappears if you change in the source code of gdb the
file "findvar.c" line 463 from

<buggy code>
    addr += SYMBOL_VALUE(var);
</buggy code>
to
<fixed code>
    addr += (signed int)SYMBOL_VALUE(var);
</fixed code>

Background:
The value stored in "var" is a negative offset from EBP. This
negative number gets converted to a huge positive number
because of the lack of sign extension when reading the stabs
debug info. Instead of a negative number we have a positive
number greater than 2Giga. When this address is added to the
EBP register value, a wrong address is the result, since
instead of a subtraction an addition is performed. The cast
reconverts the numnber into a signed 32 bit quantity that
is correctly subtracted from addr.

This has costed me approx two days of work...

"You have the source" I was told often. Well, it is true. Having
the source code *can* help sometimes, albeit it wasn't very evident.

Other problems found.

The gdb source tree will not compile correctly if you do not have
flex installed. Download flex package first before running ./configure.
Fix:
download flex, lex manually the ada.lex source and continue.

gdb:
Do not use any of the "win" commands of gdb. They are all bugged
and do not work, leaving the screen completely garbled.
Fix:
Just avoid them

Of course all "dbg front ends" will fail to debug gdb itself.
Fix: avoid them. I used gdb, and vi as editor, using several
text consoles that you can open with ctrl+alt+F1-F6.

Last time I did that was around 1984-85, when I worked for CISI
telematique Boulevard Brune a Paris.

Ahh le bons souvenirs...

jacob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]