This is the mail archive of the gdb-cvs@sourceware.org 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]

src/gdb ChangeLog objfiles.c


CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2011-12-21 07:11:53

Modified files:
	gdb            : ChangeLog objfiles.c 

Log message:
	missing check against overlay_debugging in objfiles.c
	
	This fixes a problem where the debugger is trying to locate a minimal
	symbol from its address, when the symbol is inside a section whose
	VMA is different from its LMA.
	
	We have a program that was built on ppc-elf using a linker script
	such that data sections are placed in ROM, and then loaded onto RAM
	at execution.  So their VMA addresses are indeed different from
	their LMA address.
	
	Unfortunately, there is one place where GDB gets slightly confused
	into thinking that these data sections are overlayed, while it's
	not the case here.  This show up when trying to print the list of
	Ada tasks, where GDB is unable to determine their names, and thus
	prints a generic `Ravenscar task' instead:
	
	(gdb) info tasks
	ID       TID P-ID Pri State                  Name
	1     1d580      127 Delay Sleep            Ravenscar task
	2     183f8      127 Delay Sleep            Ravenscar task
	*   3     13268      127 Runnable               Ravenscar task
	
	We expected:
	
	(gdb) info tasks
	ID       TID P-ID Pri State                  Name
	1     1d580      127 Delay Sleep            environment_task
	2     183f8      127 Delay Sleep            raven2
	*   3     13268      127 Runnable               raven1
	
	The name of the task is determined by looking up the symbol table
	using the task ID, which is the address where the symbol is defined.
	So, ada-tasks calls...
	
	msym = lookup_minimal_symbol_by_pc (task_id);
	
	... which in turn first tries to determine the section associated
	to this address (find_pc_section), which itself uses a map of sections
	to find it. The map itself is recomputed every time objfiles are
	loaded/changed by `update_section_map'. And `update_section_map'
	relies on `insert_section_p' to determine whether the section should
	be inserted in the map or not.
	
	This is where things get interesting for us, because `insert_section_p'
	simply rejects overlay sections:
	
	if (lma != 0 && lma != bfd_section_vma (abfd, section)
	&& (bfd_get_file_flags (abfd) & BFD_IN_MEMORY) == 0)
	/* This is an overlay section.  IN_MEMORY check is needed to avoid
	discarding sections from the "system supplied DSO" (aka vdso)
	on some Linux systems (e.g. Fedora 11).  */
	return 0;
	
	However, it shouldn't reject our section in this case, since overlay
	debugging is off.  The fix is to add a check that overlay debugging
	is active before rejecting the section.  This is similar to what is
	done in `section_is_overlay' (which takes obj_section objects), for
	instance.
	
	gdb/Changelog:
	
	* objfiles.c (insert_section_p): Do not detect overlay sections
	if overlay debugging is off.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13652&r2=1.13653
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/objfiles.c.diff?cvsroot=src&r1=1.133&r2=1.134


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