<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Before we decide a switch is needed, can anyone tell me what gcc does by default for C? Does gcc have a switch already?<br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br></div></span></span></span></span></span></span></span></span></div></span></div><div><div>On Feb 28, 2008, at 8:36 PM, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div class="hmmessage" style="font-size: 10pt; font-family: Tahoma; ">If this must be a switch, what should the default be?<br>I suspect the default should be full paths.<br> <br>And then, should there be switches for each of:<br> debuginfo<span class="Apple-converted-space"> </span><br> assertions<span class="Apple-converted-space"> </span><br> webinfo<span class="Apple-converted-space"> </span><br> <br>"assertions" actually use the Modula-3 equivalent of __FILE__.<br>And so, what this should perhaps looks like is, using bogus Cish names,<span class="Apple-converted-space"> </span><br> __FULL_FILE__ (e.g. /usr/home/jkrell/dev2/cm2/m3-libs/m3core/src/unix/usomething.m3)<span class="Apple-converted-space"> </span><br> __SPECIFIED_FILE__ (e.g. ..\src\foo.m3 or ..\src\thread\posix\fooposix.m3)<span class="Apple-converted-space"> </span><br> __LEAF_FILE__ (e.g. fooposix.m3)<span class="Apple-converted-space"> </span><br> <br>or maybe just the first two, and maybe the one that exists today retains its meaning and a new "full file" is introduced. And then folks can use it if they wish, and assertion maybe honors a switch.<br> <br>I hate to make everything TOO flexible and configurable though. It can get confusing, and the underutilized options may get undertested (but better now with increasing automated testing).<br> <br> - Jay<br><br><blockquote><hr id="EC_stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:jayk123@hotmail.com">jayk123@hotmail.com</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>;<span class="Apple-converted-space"> </span><a href="mailto:rodney.bates@wichita.edu">rodney.bates@wichita.edu</a><br>Date: Fri, 29 Feb 2008 01:01:02 +0000<br>CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: Re: [M3devel] FW: put full paths to source files in debug info]<br><br>Are you all serious? Telling the debugger the full path to source files via the debuginfo is bad?<br>What are the issues? I want to know so that when I use the switch I know what trouble I'm bringing myself.<br> <br>Setting breakpoints in "modules", as .dll/.so files, is unaffected I presume.<br>As is setting them by full name PosixProcess__WaitProcess.<br>That is what I "always" do ("always" as in, I just started using gdb a few weeks ago).<br> <br>What I could imagine is affected is setting them by file and line number.<br>Do people do that? I guess the gui wrappers do, but I assume that'd still work. ?<br>Maybe it depends. I should try out xcode and ddd and such?<br> <br>Do people say like break foo.c:#123? And now I've made them use a full path?<br>Gdb doesn't have any fuzzy matching?<br>Maybe in gcc I can give multiple file names?<br> <br>This really greatly improves the out-of-the-box minimally configured debugging experience.<br>Gdb automatically shows me the source as I step, instead of just file name and line number.<br>cdb/windbg at least show disassembly by default, but gdb doesn't, so by default gdb was showing hardly anything at all, quite poor. I admit, I'm at the start of the learning curve on gdb. I had to look to find the dir command. I had to look to find display/x $pc. To use the dir command, I have to constantly switch my slashes, since I get the paths from dir /s/b.<br> <br>I will make it a switch in cm3 and cm3cg if it is really a problem.<br> <br>In C it is a common idiom:<br>void assert_failed(const char* condition, const char* file, unsigned line);<br>#define assert(expr) ((expr) ? assert_failed(#expr, __FILE__, __LINE__) : (void)0)<br> <br>__FILE__ can vary between "the parameter to the compiler on the command line", or "full path", depending on implementation.<br> <br>Also:<br>printf("foo is %d in %s\n", foo, __FILE__).<br> <br>This really just seems like basic correctness to me, to give a debugger full paths.<br>I'm quite surprised by the pushback.<br> <br>Assertions I think should also be "fixed" further. And I suspect "webinfo" but that could wait until Reactor is available..<br> <br> - Jay<br><br><br><hr id="EC_stopSpelling"><br>> From:<span class="Apple-converted-space"> </span><a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a><br>> To:<span class="Apple-converted-space"> </span><a href="mailto:rodney.bates@wichita.edu">rodney.bates@wichita.edu</a><br>> Date: Thu, 28 Feb 2008 14:12:33 -0500<br>> CC:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> Subject: Re: [M3devel] FW: put full paths to source files in debug info]<br>><span class="Apple-converted-space"> </span><br>> I concur with Rodney on this. There are deeper issues here than<span class="Apple-converted-space"> </span><br>> simply avoiding the need to use dir in gdb.<br>><span class="Apple-converted-space"> </span><br>> On Feb 28, 2008, at 2:05 PM, Rodney M. Bates wrote:<br>><span class="Apple-converted-space"> </span><br>> ><br>> > I don't understand what the need for these paths is. In every<span class="Apple-converted-space"> </span><br>> > complete<br>> > program, all the interfaces and all the modules must have unique<span class="Apple-converted-space"> </span><br>> > simple<br>> > names, otherwise code could not refer to them. With the filename<span class="Apple-converted-space"> </span><br>> > matchup<br>> > rules, this should make all the simple file names unique too. So any<br>> > debug commands should never need a path. And using simple names<span class="Apple-converted-space"> </span><br>> > avoids<br>> > the problems of moving compiled code.<br>> ><br>> > Is it more output from the debugger you want? If so, this could no<span class="Apple-converted-space"> </span><br>> > doubt<br>> > be done by the debugger itself with the debug info as it was. It<span class="Apple-converted-space"> </span><br>> > already<br>> > contained one copy of the full path to the source file in each<span class="Apple-converted-space"> </span><br>> > object file,<br>> > though I don't know of a place the debugger uses this now.<br>> ><br>> > Yes, I know the filename/modulename rules don't actually apply for<span class="Apple-converted-space"> </span><br>> > modules,<br>> > but not following them is a bad practice. I've been around that<span class="Apple-converted-space"> </span><br>> > block many<br>> > times with Ada, and believe me, it's a nightmare. Furthermore, then<span class="Apple-converted-space"> </span><br>> > you<br>> > wouldn't be able to name things in the debugger as<span class="Apple-converted-space"> </span><br>> > ModuleName.VarOrProcInModule,<br>> > This construct does not exist in code but is very useful in<span class="Apple-converted-space"> </span><br>> > debugging, especially<br>> > when InterfaceName/ModuleName is not one-to-one, e.g. when a module<span class="Apple-converted-space"> </span><br>> > exports >1<br>> > interface, etc.<br>> ><br>> > Jay wrote:<br>> >> truncated again! and possibly misformated..<br>> >><span class="Apple-converted-space"> </span><br>> >> ------------------------------------------------------------------------<br>> >> From:<span class="Apple-converted-space"> </span><a href="mailto:jayk123@hotmail.com">jayk123@hotmail.com</a><br>> >> To:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> >> Subject: RE: put full paths to source files in debug info<br>> >> Date: Thu, 28 Feb 2008 08:44:11 +0000<br>> >> pps: "webinfo" (Reactor?) and assertion failures are affected by<br>> >> this also, but not fully.<br>> >> Before you would have gotten:<br>> >> ***<br>> >> *** runtime error:<br>> >> *** <*ASSERT*> failed.<br>> >> *** file "WaitProcessCygwin.m3", line 16<br>> >> ***<br>> >> but now you get:<br>> >> ***<br>> >> *** runtime error:<br>> >> *** <*ASSERT*> failed.<br>> >> *** file "..\src\thread\WIN32\WaitProcessCygwin.m3", line 16<br>> >> ***<br>> >> I'd say the realpath call (or whatever the portable Modula-3<span class="Apple-converted-space"> </span><br>> >> library<br>> >> call is) should be moved up to m3front to address these, and the<br>> >> parse.c change undone.<br>> >> As well, I believe resolving symlinks is happening too but<span class="Apple-converted-space"> </span><br>> >> that<br>> >> wasn't the point, so something instead of realpath might be<br>> >> preferable. Like, just see if the string starts ".\" or "..\", it<br>> >> will almost always start "..\", and if so, prepend current working<br>> >> directory and then workout the dots.<br>> >> It may also be reasonable to provide paths to the compiler<span class="Apple-converted-space"> </span><br>> >> to remove<br>> >> from the starts of paths, which would likely address the symlink<br>> >> issue, since they are more likely to be nearer the start of the<span class="Apple-converted-space"> </span><br>> >> path<br>> >> than the middle or end. As well as partly the<br>> >> privacy/size/same-across-machines issues.<br>> >> In any case, I think this easy small change is already very<span class="Apple-converted-space"> </span><br>> >> useful<br>> >> progress. Or does everyone else just fill up .gdbinit with dir<br>> >> commands? It seems to me that it shouldn't even that difficult,<span class="Apple-converted-space"> </span><br>> >> even<br>> >> if it isn't very difficult.<br>> >> Agreed?<br>> >> - Jay<br>> >><span class="Apple-converted-space"> </span><br>> >> ------------------------------------------------------------------------<br>> >> From:<span class="Apple-converted-space"> </span><a href="mailto:jayk123@hotmail.com">jayk123@hotmail.com</a><br>> >> To:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>> >> Subject: re: put full paths to source files in debug info<br>> >> Date: Thu, 28 Feb 2008 08:31:32 +0000<br>> >> ps: does anyone care that binaries built from different cvs<br>> >> checkouts, but otherwise identical source, will no longer match,<br>> >> unless perhaps they are "stripped"?<br>> >> If so, or if any of the other issues bug people, or any other<br>> >> problem is brought up or discovered, this can be made a command<br>> >> line option. I will always turn it on. :)<br>> >> - Jay<br>> >><span class="Apple-converted-space"> </span><br>> >> ------------------------------------------------------------------------<br>> >> > Date: Thu, 28 Feb 2008 09:23:22 +0000<br>> >> > To:<span class="Apple-converted-space"> </span><a href="mailto:m3commit@elegosoft.com">m3commit@elegosoft.com</a><br>> >> > From:<span class="Apple-converted-space"> </span><a href="mailto:jkrell@elego.de">jkrell@elego.de</a><br>> >> > Subject: [M3commit] CVS Update: cm3<br>> >> ><br>> >> > CVSROOT: /usr/cvs<br>> >> > Changes by: jkrell@birch. 08/02/28 09:23:22<br>> >> ><br>> >> > Modified files:<br>> >> > cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c<br>> >> > cm3/m3-sys/m3front/src/misc/: Coverage.m3 Host.i3 Host.m3<br>> >> > Scanner.m3<br>> >> ><br>> >> > Log message:<br>> >> > put full paths to source files in debug info<br>> >> ><br>> >> > This has the minor downsides of:<br>> >> > 1) grows the debug info (it is already huge; who is counting?)<br>> >> > 2) reveals file system layout in debug info (privacy?)<br>> >> > 3) does it inhibit debugging files from other people's machines<br>> >> or does gdb dir still work?<br>> >> ><br>> >> > but definitely makes for a more pleasant debugging experience<span class="Apple-converted-space"> </span><br>> >> when<br>> >> > debugging stuff you have built yourself.<br>> >> ><br>> >> > The linear searching to see if a name has been allocated a<span class="Apple-converted-space"> </span><br>> >> number yet<br>> >> > will obviously slow way down due to a large increase in common<br>> >> prefixes,<br>> >> > but that should be a hash table anyway. Linear search is lame.<br>> >> > (or a trie, but working from the ends of the strings, minus the<br>> >> last one or few<br>> >> > characters, due to common prefixes as well as common suffixes)<br>> >> ><br>> >> > Note that both m3front and m3cc changes are needed as m3front<span class="Apple-converted-space"> </span><br>> >> has<br>> >> paths<br>> >> > relative to the current working directory or such.<br>> >> ><br>> >> > For most packages, you can get by without the m3front change<span class="Apple-converted-space"> </span><br>> >> and<br>> >> just prepend<br>> >> > "../src/" to the path in m3cc, but that doesn't work for<br>> >> hierarchical packages<br>> >> > such as libm3 and m3core which I am debugging.<br>> >> ------------------------------------------------------------------------<br>> >> Need to know the score, the latest news, or you need your HotmailŪ-<span class="Apple-converted-space"> </span><br>> >> get your "fix". Check it out. <<a href="http://www.msnmobilefix.com/Default.aspx">http://www.msnmobilefix.com/Default.aspx</a><span class="Apple-converted-space"> </span><br>> >> ><br>> ><br>> > --<span class="Apple-converted-space"> </span><br>> > -------------------------------------------------------------<br>> > Rodney M. Bates, retired assistant professor<br>> > Dept. of Computer Science, Wichita State University<br>> > Wichita, KS 67260-0083<br>> > 316-978-3922<br>> ><span class="Apple-converted-space"> </span><a href="mailto:rodney.bates@wichita.edu">rodney.bates@wichita.edu</a><br>><span class="Apple-converted-space"> </span><br><br><br><hr>Need to know the score, the latest news, or you need your HotmailŪ-get your "fix".<span class="Apple-converted-space"> </span><a href="http://www.msnmobilefix.com/Default.aspx" target="_blank">Check it out.</a></blockquote><br><hr>Climb to the top of the charts! Play the word scramble challenge with star power.<span class="Apple-converted-space"> </span><a href="http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan" target="_new">Play now!</a></div></span></blockquote></div><br></body></html>