* RE: [RFA/RFC] blockframe.c Fix errorneous addr check
@ 2002-06-28 1:41 Andrew Volkov
2002-06-28 9:26 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Volkov @ 2002-06-28 1:41 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
>On Jun 27, 10:58pm, Andrew Volkov wrote:
>
>> >> current_source_end_addr = start_addr + size;
>> >>
>> >> but must be:
>> >>
>> >> current_source_end_addr = start_addr + size + <addr sizeof>;
>> >>
>> >> As I understand, since machine address size is not known at
>> >time of parsing
>> >> coff file, then we have big trouble :(.
>> >
>> >Could you explain why you need to add in the size of an address?
>>
>> It's not necessarily must be addr sizeof, it may be 1, but, I think,
>> will be better, if current_source_end_addr will contain correct
>> value for target.
>
>What I'd like to understand is why (start_addr + size) is insufficient.
>I.e, why do we need to add 1 or some other small value to compute the
>correct ending address?
>
>Kevin
Because start_addr + size is last_addr in block, hence all gdb parts, wich
assume that highpc is first addr after block, will work improperly.
Ex. this check always failed:
if (addr >= lowpc && addr < highpc)
....
when addr = last_addr_in_block.
While I bump with this problem when work with h8300 coff file.
Andrey
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/RFC] blockframe.c Fix errorneous addr check
2002-06-28 1:41 [RFA/RFC] blockframe.c Fix errorneous addr check Andrew Volkov
@ 2002-06-28 9:26 ` Kevin Buettner
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Buettner @ 2002-06-28 9:26 UTC (permalink / raw)
To: Andrew Volkov, Kevin Buettner; +Cc: gdb-patches
On Jun 28, 12:41pm, Andrew Volkov wrote:
> >On Jun 27, 10:58pm, Andrew Volkov wrote:
> >
> >> >> current_source_end_addr = start_addr + size;
> >> >>
> >> >> but must be:
> >> >>
> >> >> current_source_end_addr = start_addr + size + <addr sizeof>;
> >> >>
> >> >> As I understand, since machine address size is not known at
> >> >time of parsing
> >> >> coff file, then we have big trouble :(.
> >> >
> >> >Could you explain why you need to add in the size of an address?
> >>
> >> It's not necessarily must be addr sizeof, it may be 1, but, I think,
> >> will be better, if current_source_end_addr will contain correct
> >> value for target.
> >
> >What I'd like to understand is why (start_addr + size) is insufficient.
> >I.e, why do we need to add 1 or some other small value to compute the
> >correct ending address?
>
> Because start_addr + size is last_addr in block, hence all gdb parts, wich
> assume that highpc is first addr after block, will work improperly.
According to the comment just prior to complete_symtab(), ``size'' is
the number of bytes of text. If that's really the case, then
start_addr + size should be the first address beyond the section in
question.
> Ex. this check always failed:
>
> if (addr >= lowpc && addr < highpc)
> ....
>
> when addr = last_addr_in_block.
I see.
I think we need to look elsewhere for the bug though. I think
``size'' is being computed incorrectly earlier on. While it's
possible that the bug is in gdb or bfd, I'm now suspicious of the
value obtained from the object file.
> While I bump with this problem when work with h8300 coff file.
Can you post the output of ``objdump -h'' on one of these coff files?
Take a look at the size that it reports for .text and let us know if
it appears too small to you.
If it is too small, then the bug is in some other part of the toolchain,
possibly the linker.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/RFC] blockframe.c Fix errorneous addr check
2002-06-27 11:58 Andrew Volkov
@ 2002-06-27 12:18 ` Kevin Buettner
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Buettner @ 2002-06-27 12:18 UTC (permalink / raw)
To: Andrew Volkov, Kevin Buettner; +Cc: gdb-patches, jimb, ezannoni
On Jun 27, 10:58pm, Andrew Volkov wrote:
> >> current_source_end_addr = start_addr + size;
> >>
> >> but must be:
> >>
> >> current_source_end_addr = start_addr + size + <addr sizeof>;
> >>
> >> As I understand, since machine address size is not known at
> >time of parsing
> >> coff file, then we have big trouble :(.
> >
> >Could you explain why you need to add in the size of an address?
>
> It's not necessarily must be addr sizeof, it may be 1, but, I think,
> will be better, if current_source_end_addr will contain correct
> value for target.
What I'd like to understand is why (start_addr + size) is insufficient.
I.e, why do we need to add 1 or some other small value to compute the
correct ending address?
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [RFA/RFC] blockframe.c Fix errorneous addr check
@ 2002-06-27 11:58 Andrew Volkov
2002-06-27 12:18 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Volkov @ 2002-06-27 11:58 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches, jimb, ezannoni
>
>On Jun 27, 10:08pm, Andrew Volkov wrote:
>
>> Daniel you're right, this bug in coffread.c(complete_symtab)
>function,
>> rather, in invalid calculating of current_source_end_addr:
>>
>> current_source_end_addr = start_addr + size;
>>
>> but must be:
>>
>> current_source_end_addr = start_addr + size + <addr sizeof>;
>>
>> As I understand, since machine address size is not known at
>time of parsing
>> coff file, then we have big trouble :(.
>
>Could you explain why you need to add in the size of an address?
It's not necessarily must be addr sizeof, it may be 1, but, I think,
will be better, if current_source_end_addr will contain correct
value for target.
>
>Assuming it is needed, won't TARGET_PTR_BIT / TARGET_CHAR_BIT
>provide the
>correct size?
>
>Kevin
>
Sorry, I forget about this macros :)
Andrey
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/RFC] blockframe.c Fix errorneous addr check
2002-06-27 11:08 Andrew Volkov
@ 2002-06-27 11:39 ` Kevin Buettner
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Buettner @ 2002-06-27 11:39 UTC (permalink / raw)
To: Andrew Volkov, Daniel Jacobowitz; +Cc: gdb-patches, jimb, ezannoni
On Jun 27, 10:08pm, Andrew Volkov wrote:
> Daniel you're right, this bug in coffread.c(complete_symtab) function,
> rather, in invalid calculating of current_source_end_addr:
>
> current_source_end_addr = start_addr + size;
>
> but must be:
>
> current_source_end_addr = start_addr + size + <addr sizeof>;
>
> As I understand, since machine address size is not known at time of parsing
> coff file, then we have big trouble :(.
Could you explain why you need to add in the size of an address?
Assuming it is needed, won't TARGET_PTR_BIT / TARGET_CHAR_BIT provide the
correct size?
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [RFA/RFC] blockframe.c Fix errorneous addr check
@ 2002-06-27 11:08 Andrew Volkov
2002-06-27 11:39 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Volkov @ 2002-06-27 11:08 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, jimb, ezannoni
>On Thu, Jun 27, 2002 at 09:13:41PM +0400, Andrew Volkov wrote:
>> Hi,
>>
>> This patch fix wrong detection of belonging addr to startup file:
>> if call main is last instuction in crt0, then
>> inside_entry_file erroneously return false.
>>
>> Ok to commit?
>> Andrey
>>
>> P.S. Possible this bug not in this func, but in symbol reader.
>
>I'm inclined to believe the bug is in the symbol reader. Upper PC
>bounds are generally exclusive - first address after the function.
>
>--
>Daniel Jacobowitz Carnegie Mellon University
>MontaVista Software Debian GNU/Linux Developer
>
Daniel you're right, this bug in coffread.c(complete_symtab) function,
rather, in invalid calculating of current_source_end_addr:
current_source_end_addr = start_addr + size;
but must be:
current_source_end_addr = start_addr + size + <addr sizeof>;
As I understand, since machine address size is not known at time of parsing
coff file, then we have big trouble :(.
Comments/suggestions?
Andrey
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/RFC] blockframe.c Fix errorneous addr check
2002-06-27 10:13 Andrew Volkov
@ 2002-06-27 10:18 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2002-06-27 10:18 UTC (permalink / raw)
To: Andrew Volkov; +Cc: gdb-patches, jimb, ezannoni
On Thu, Jun 27, 2002 at 09:13:41PM +0400, Andrew Volkov wrote:
> Hi,
>
> This patch fix wrong detection of belonging addr to startup file:
> if call main is last instuction in crt0, then
> inside_entry_file erroneously return false.
>
> Ok to commit?
> Andrey
>
> P.S. Possible this bug not in this func, but in symbol reader.
I'm inclined to believe the bug is in the symbol reader. Upper PC
bounds are generally exclusive - first address after the function.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFA/RFC] blockframe.c Fix errorneous addr check
@ 2002-06-27 10:13 Andrew Volkov
2002-06-27 10:18 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Volkov @ 2002-06-27 10:13 UTC (permalink / raw)
To: gdb-patches; +Cc: jimb, ezannoni
Hi,
This patch fix wrong detection of belonging addr to startup file:
if call main is last instuction in crt0, then
inside_entry_file erroneously return false.
Ok to commit?
Andrey
P.S. Possible this bug not in this func, but in symbol reader.
2002-06-27 Andrey Volkov <avolkov@transas.com>
*blockframe.c (inside_entry_file): Fixed erroneous check that
addr is in startup file.
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.30
diff -u -r1.30 blockframe.c
--- blockframe.c 26 Jun 2002 15:28:46 -0000 1.30
+++ blockframe.c 27 Jun 2002 16:33:10 -0000
@@ -113,7 +113,7 @@
return 0;
}
return (addr >= symfile_objfile->ei.entry_file_lowpc &&
- addr < symfile_objfile->ei.entry_file_highpc);
+ addr <= symfile_objfile->ei.entry_file_highpc);
}
/* Test a specified PC value to see if it is in the range of addresses
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-06-28 16:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-28 1:41 [RFA/RFC] blockframe.c Fix errorneous addr check Andrew Volkov
2002-06-28 9:26 ` Kevin Buettner
-- strict thread matches above, loose matches on Subject: below --
2002-06-27 11:58 Andrew Volkov
2002-06-27 12:18 ` Kevin Buettner
2002-06-27 11:08 Andrew Volkov
2002-06-27 11:39 ` Kevin Buettner
2002-06-27 10:13 Andrew Volkov
2002-06-27 10:18 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox