Board index » delphi » Using Find|Error to locate a hex address?

Using Find|Error to locate a hex address?

I am trying to find the line of code that is causing an access violation
in my program.  I am using Delphi 2 by the way.  I have compiled my
program with TDW debug information and also compiled the VCL library with
debug information and I thought this would allow me to use the Find Error
dialog to locate the address in my program.  Can someone tell me what
I am doing wrong?

Thanks, Mark

 

Re:Using Find|Error to locate a hex address?


On 2 Nov 1997 01:27:52 -0600, ho...@inetnebr.com (Mr. Mark R Horan)
wrote:

Quote
>I am trying to find the line of code that is causing an access violation
>in my program.  I am using Delphi 2 by the way.  I have compiled my
>program with TDW debug information and also compiled the VCL library with
>debug information and I thought this would allow me to use the Find Error
>dialog to locate the address in my program.  Can someone tell me what
>I am doing wrong?

There's a bug in the D2 IDE that stops it from finding errors.
There's a way around it, but I forget what it is exactly:  it's
something to do with uncorrecting the corrected address that gets
reported, or correcting the uncorrected address that gets reported.
I don't have D2 installed any more or I'd try it and tell you.

Here are the various possibilities for addresses that might be
reported or might be usable in the IDE:

1.  The address in the .MAP file.  This is usually presented in the
.MAP as a segmented address, e.g. 0001:00000ABC, but you never see or
use the segment part, you just use the offset to the routine from the
start of the segment, i.e. 00000ABC.

2. The offset to the routine from the start of the code image.  This
is generally 1000 higher, i.e. 00001ABC.

3. The address at which the code was loaded.  This is generally
something like 4001ABC.

Take a look at the map file for a program so you know the type 1
address of a routine, and just try searching for each of these 3
addresses; you should find that one of them works.  Then create a
runerror of some sort, and see which one gets reported.

I hope this helps!

Duncan Murdoch

Re:Using Find|Error to locate a hex address?


  Start using Delphi's de{*word*81}...  Set breakpoints where you think the
problem may be, and use F8 to step through the program...
  Also, what is the GPF?  (do you see READ of FFFFFFFF?)  That's a clue to
what might be happening....

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are MicroSoft.  You will be assimilated.  Resistance is Futile."
--
Mr. Mark R Horan wrote in message <63ha1o$f9...@falcon.inetnebr.com>...

Quote
>I am trying to find the line of code that is causing an access violation
>in my program.  I am using Delphi 2 by the way.  I have compiled my
>program with TDW debug information and also compiled the VCL library with
>debug information and I thought this would allow me to use the Find Error
>dialog to locate the address in my program.  Can someone tell me what
>I am doing wrong?

Re:Using Find|Error to locate a hex address?


Quote
> On 2 Nov 1997 01:27:52 -0600, ho...@inetnebr.com (Mr. Mark R Horan) wrote:
> >I am trying to find the line of code that is causing an access violation
> >in my program.  I am using Delphi 2 by the way.  I have compiled my
> >program with TDW debug information and also compiled the VCL library with
> >debug information and I thought this would allow me to use the Find Error
> >dialog to locate the address in my program.
> Duncan Murdoch wrote:
> There's a bug in the D2 IDE that stops it from finding errors.
> There's a way around it, but I forget what it is exactly:  it's
> something to do with uncorrecting the corrected address that gets
> reported, or correcting the uncorrected address that gets reported.

Delphi 2 subtracts OFFSET TextStart (or Integer(@TextStart)) from the
exception address before it displays it. You need to add this number back
before plugging the address into Search|Find Error. Probably the best thing to
do is to install a new default exception handler via ExceptProc to do this for
you. The handler has a prototype of

procedure DefaultExceptionHandler(ExceptObject: TObject; ExceptAddr: Pointer);

Chris.

Re:Using Find|Error to locate a hex address?


Quote
On Mon, 03 Nov 1997 19:51:33 -0500, Chris Rankin wrote:
>Delphi 2 subtracts OFFSET TextStart (or Integer(@TextStart)) from the
>exception address before it displays it.

It definitely does not do this for me!

Quote
>You need to add this number back before plugging the address into =

Search|Find Error.

=46unny, I had to do exactly the opposite for Search|Find Error to work
correctly. Even worse is that it one case it was the @TextStart I had to
subtract and in other case it was the Project|Options...|Linker|Image
Base (which is less than @TextStart by a few kilobytes).

But I suspect that one solution was good for Delphi 2 and another for
Delphi 3.

Additionally, note that Search|Find Error may not NOT fail at all in
case of small and simple projects! I created a tiny demo which just
references a nil-pointer for triggering an exception and the reported
error address worked OK without any "preprocessing"...

Can't understand why Borland didn't fix all this in Delphi 3.

Regards,
Erik

Re:Using Find|Error to locate a hex address?


Quote
> On Mon, 03 Nov 1997 19:51:33 -0500, Chris Rankin wrote:
> >Delphi 2 subtracts OFFSET TextStart (or Integer(@TextStart)) from the
> >exception address before it displays it.
Erik wrote:
>It definitely does not do this for me!

I was talking strictly Delphi **2** here. The relevant source-code is the ConvertAddr()
function in SysUtils. In Delphi 2, the Search|Find Error dialogue expected an actual
memory address, whereas Delphi 3 expects this logical memory address. The problem now is
that not all D3 exceptions display logical error addresses.

Chris.

Other Threads