* Re: the "load" command and the .bss section [not found] ` <20080427135600.GA9356@caradoc.them.org> @ 2008-04-28 8:34 ` Mike Frysinger 2008-04-28 8:39 ` Eli Zaretskii 0 siblings, 1 reply; 6+ messages in thread From: Mike Frysinger @ 2008-04-28 8:34 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches [-- Attachment #1.1: Type: text/plain, Size: 1442 bytes --] On Sunday 27 April 2008, Daniel Jacobowitz wrote: > On Sun, Apr 27, 2008 at 05:09:31AM -0400, Mike Frysinger wrote: > > i was doing a new board port using jtag and so was leveraging the "load" > > command to setup the initial ELF in the relevant memory regions. things > > kept crashing on me and then i realized that the loading process wasnt > > actually zeroing out the bss. is there a reason for this ? i googled > > and flipped through the manual, but the details on what exactly the > > "load" command is supposed to do is a bit on sketchy side. from what i > > can tell from the gdb source code and the actual output from running the > > command, it walks the section headers (rather than the program headers ?) > > and loads up everything that is in the file. since the bss section > > doesnt actually exist in the file and is only allocated, that is why it > > gets skipped ? > > Load puts things at their LMA rather than their VMA. So it assumes > that whatever sets up load -> virtual also handles bss; it's more like > flash programming than like the Linux kernel's loader. Heck, > sometimes it is flash programming... ah, now that i know the intentions, may i suggest the following to the documentation. -mike 2008-04-27 Mike Frysinger <vapier@gentoo.org> * gdb.texinfo (Commands for Managing Targets): Clarify load command wrt load/virtual addresses and handling of allocated sections. [-- Attachment #1.2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 827 bytes --] [-- Attachment #2: gdb-clarify-load.patch --] [-- Type: text/x-diff, Size: 1278 bytes --] Index: gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.487 diff -u -p -r1.487 gdb.texinfo --- gdb.texinfo 24 Apr 2008 12:09:49 -0000 1.487 +++ gdb.texinfo 27 Apr 2008 21:43:57 -0000 @@ -12795,10 +12795,12 @@ If your @value{GDBN} does not have a @co execute it gets the error message ``@code{You can't do that when your target is @dots{}}'' -The file is loaded at whatever address is specified in the executable. -For some object file formats, you can specify the load address when you -link the program; for other formats, like a.out, the object file format -specifies a fixed address. +The file is loaded according to the load addresses (rather than virtual) as +is specified in the executable. It is expected that the target system will +do the actual relocation, and in the process, handle such things as setup of +allocated sections (e.g. the bss). For some object file formats, you can +specify the load address when you link the program; for other formats, like +a.out, the object file format specifies a fixed address. @c FIXME! This would be a good place for an xref to the GNU linker doc. Depending on the remote side capabilities, @value{GDBN} may be able to ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: the "load" command and the .bss section 2008-04-28 8:34 ` the "load" command and the .bss section Mike Frysinger @ 2008-04-28 8:39 ` Eli Zaretskii 2008-04-28 14:07 ` Mike Frysinger 2008-04-28 19:08 ` Michael Snyder 0 siblings, 2 replies; 6+ messages in thread From: Eli Zaretskii @ 2008-04-28 8:39 UTC (permalink / raw) To: Mike Frysinger; +Cc: drow, gdb-patches > From: Mike Frysinger <vapier@gentoo.org> > Date: Sun, 27 Apr 2008 17:45:37 -0400 > Cc: gdb-patches@sourceware.org > > ah, now that i know the intentions, may i suggest the following to the > documentation. Thanks, but I'm afraid the text you suggested is not clear enough. > +The file is loaded according to the load addresses (rather than virtual) as How is "load address" opposed to "virtual address"? This requires explanation. > +is specified in the executable. It is expected that the target system will > +do the actual relocation, and in the process, handle such things as setup of > +allocated sections (e.g. the bss). This is also too cryptic to be useful. Can you (or someone else) suggest a more elaborate description? E.g., what is ``relocation'' in this context? and what other things besides .bss are expected to be set up by loading? TIA ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: the "load" command and the .bss section 2008-04-28 8:39 ` Eli Zaretskii @ 2008-04-28 14:07 ` Mike Frysinger 2008-04-28 22:54 ` Eli Zaretskii 2008-04-28 19:08 ` Michael Snyder 1 sibling, 1 reply; 6+ messages in thread From: Mike Frysinger @ 2008-04-28 14:07 UTC (permalink / raw) To: Eli Zaretskii; +Cc: drow, gdb-patches [-- Attachment #1: Type: text/plain, Size: 1497 bytes --] On Sunday 27 April 2008, Eli Zaretskii wrote: > > From: Mike Frysinger <vapier@gentoo.org> > > Date: Sun, 27 Apr 2008 17:45:37 -0400 > > Cc: gdb-patches@sourceware.org > > > > ah, now that i know the intentions, may i suggest the following to the > > documentation. > > Thanks, but I'm afraid the text you suggested is not clear enough. > > > +The file is loaded according to the load addresses (rather than virtual) > > as > > How is "load address" opposed to "virtual address"? This requires > explanation. > > > +is specified in the executable. It is expected that the target system > > will +do the actual relocation, and in the process, handle such things as > > setup of +allocated sections (e.g. the bss). > > This is also too cryptic to be useful. Can you (or someone else) > suggest a more elaborate description? E.g., what is ``relocation'' in > this context? and what other things besides .bss are expected to be > set up by loading? the load description in general implies the reader already has higher knowledge of these details. i dont see the changes i propose affecting this in any way. i'm not sure expounding on the lower (and format-specific) details being appropriate in this context as the final decision is up to the target bfd, not gdb. if someone else wants to expand the description, go for it, but i'm fine with the small additions i've contributed, and i think the issues raised here are unrelated to the new text. -mike [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 827 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: the "load" command and the .bss section 2008-04-28 14:07 ` Mike Frysinger @ 2008-04-28 22:54 ` Eli Zaretskii 0 siblings, 0 replies; 6+ messages in thread From: Eli Zaretskii @ 2008-04-28 22:54 UTC (permalink / raw) To: Mike Frysinger; +Cc: gdb-patches > From: Mike Frysinger <vapier@gentoo.org> > Date: Sun, 27 Apr 2008 23:31:20 -0400 > Cc: drow@false.org, > gdb-patches@sourceware.org > > the load description in general implies the reader already has higher > knowledge of these details. i dont see the changes i propose affecting this > in any way. i'm not sure expounding on the lower (and format-specific) > details being appropriate in this context as the final decision is up to the > target bfd, not gdb. Sorry, I didn't mean for you to explain any format-specific details, certainly not at the BFD level. Just general principles, which I think are common to all formats. If some important details are inherently specific to the binary format, describing what happens with the most popular one, or using "e.g.", would be good enough. > if someone else wants to expand the description, go for it, but i'm fine with > the small additions i've contributed, and i think the issues raised here are > unrelated to the new text. But the addition to the manual will only be useful to someone other than yourself, because you already learned this the hard way. So the fact that these additions are good enough for you does not mean they are a useful addition to the manual; for that, the additions need to be explanatory enough to allow others learn from your experience rather than from their own. Now, I know something about loading programs, so if the changes you propose are not clear for me, chances are they won't be clear enough for other readers of the manual as well. In my experience, the best candidate to write about a certain issue is someone who couldn't find that in the manual, learned about it the hard way, and can tell others what they need to know. That is because that someone knows, in 20-20 hindsight, what she would like to be in the manual in the first place. So I urge you to try to describe this in some more detail, for the benefit of others who will go in your footsteps. Thanks in advance. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: the "load" command and the .bss section 2008-04-28 8:39 ` Eli Zaretskii 2008-04-28 14:07 ` Mike Frysinger @ 2008-04-28 19:08 ` Michael Snyder 2008-04-29 1:10 ` Eli Zaretskii 1 sibling, 1 reply; 6+ messages in thread From: Michael Snyder @ 2008-04-28 19:08 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Mike Frysinger, drow, gdb-patches On Mon, 2008-04-28 at 06:26 +0300, Eli Zaretskii wrote: > > From: Mike Frysinger <vapier@gentoo.org> > > Date: Sun, 27 Apr 2008 17:45:37 -0400 > > Cc: gdb-patches@sourceware.org > > > > ah, now that i know the intentions, may i suggest the following to the > > documentation. > > Thanks, but I'm afraid the text you suggested is not clear enough. > > > +The file is loaded according to the load addresses (rather than virtual) as > > How is "load address" opposed to "virtual address"? This requires > explanation. > > > +is specified in the executable. It is expected that the target system will > > +do the actual relocation, and in the process, handle such things as setup of > > +allocated sections (e.g. the bss). > > This is also too cryptic to be useful. Can you (or someone else) > suggest a more elaborate description? E.g., what is ``relocation'' in > this context? and what other things besides .bss are expected to be > set up by loading? I extend a cautionary rejoinder -- "load" means different things in different contexts. I have not looked at this recently, but the last time I did, there were several different implementations of the "load" command, and they did not all behave identically, particularly with regard to the concept of VMA vs. LMA. That's one reason it hasn't been well documented -- it is not particularly well defined. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: the "load" command and the .bss section 2008-04-28 19:08 ` Michael Snyder @ 2008-04-29 1:10 ` Eli Zaretskii 0 siblings, 0 replies; 6+ messages in thread From: Eli Zaretskii @ 2008-04-29 1:10 UTC (permalink / raw) To: Michael Snyder; +Cc: vapier, drow, gdb-patches > From: Michael Snyder <msnyder@specifix.com> > Cc: Mike Frysinger <vapier@gentoo.org>, drow@false.org, gdb-patches@sourceware.org > Date: Mon, 28 Apr 2008 11:34:13 -0700 > > I have not looked at this recently, but the last time I did, > there were several different implementations of the "load" > command, and they did not all behave identically, particularly > with regard to the concept of VMA vs. LMA. > > That's one reason it hasn't been well documented -- it is > not particularly well defined. I'm trying to establish whether there's something we could say in the manual about this that would be useful to readers. If there's nothing to be said about this issue that's generally useful, we can just say nothing. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-04-28 19:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200804270509.34308.vapier@gentoo.org>
[not found] ` <20080427135600.GA9356@caradoc.them.org>
2008-04-28 8:34 ` the "load" command and the .bss section Mike Frysinger
2008-04-28 8:39 ` Eli Zaretskii
2008-04-28 14:07 ` Mike Frysinger
2008-04-28 22:54 ` Eli Zaretskii
2008-04-28 19:08 ` Michael Snyder
2008-04-29 1:10 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox