This is the mail archive of the mailing list for the GDB 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: [rfc / remote protocol] ELF segment based qOffsets

Hello Daniel,

Daniel Jacobowitz wrote:
On Fri, Dec 14, 2007 at 01:27:33PM +0300, Sergei Poselenov wrote:
You see, the warnings are caused by the fact that the segment 01 has
address/size values which wraps to 0 in the following 'if' condition
introduced by the $subj in elfread.c, elf_symfile_segments():
&& vma < segments[j]->p_vaddr + segments[j]->p_memsz)

Drat. Yes, this just seems like a bug. I'll try to fix it later.

Please review attached.

The place above is trivial to fix, but I wonder will be any
other consequences to the remote debugging of such kind of
images? (I can't try this at the moment)

I don't think there should be any problems. There would be a little trouble debugging code from those sections if the image was relocated (qOffsets response), but yours shouldn't be; it goes at the address in the ELF file.

OK, thanks.

--- gdb-6.7/gdb/elfread.c.orig	2007-12-19 16:27:32.000000000 +0100
+++ gdb-6.7/gdb/elfread.c	2007-12-19 16:32:21.000000000 +0100
@@ -107,7 +107,7 @@ elf_symfile_segments (bfd *abfd)
       for (j = 0; j < num_segments; j++)
 	if (segments[j]->p_memsz > 0
 	    && vma >= segments[j]->p_vaddr
-	    && vma < segments[j]->p_vaddr + segments[j]->p_memsz)
+	    && (vma - segments[j]->p_vaddr) > segments[j]->p_memsz)
 	    data->segment_info[i] = j + 1;

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