This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
> >> Because we use the stabs debugging format, we could simply link in >> a module which defines a 'main stab'. gdb honors this stab type, and >> treats the name given with this stab like 'main'. In particular, >> backtraces stop at this function. > >Are you using any particular compiler/linker switches to achieve this? >I can only get this to work if I patch GDB's dbxread.c. Ah yes. The N_MAIN stab is seen in process_one_symbol (in dbxread.c), and the name given ends up in the variable name_of_main. I remember vaguely that this worked only with gdb --readnow; to have this available in the general case we needed also a patch like the one you proposed. Sorry, I completely forgot this. > >> This may be restricted to the stabs debugging format, though, and it >> won't help if you don't have such a "topmost" function. > >And it won't help if you have multiple such functions. Otherwise the >trick is neat, even though a work-around for the initial problem. > Yes. This is definitely only a workaround. I also investigated this for a while, and I came up with the following hack, which works when the stack is terminated with two zero values (for previous ebp and return address): - at the very beginning of function inside_main_func (in blockframe.c) insert if ((pc == 0) || (pc == 0xffffffff)) return 1; - at the end of get_prev_frame (in frame.c), replace /* Link it in. */ this_frame->prev = prev_frame; prev_frame->next = this_frame; by /* Link it in. */ prev_frame->next = this_frame; if (get_frame_pc(prev_frame) == 0) return NULL; this_frame->prev = prev_frame; This hack may or may not work in your case (we use gdb-6.1), so use with caution. Regards D.Ruppert ePS&RTS GmbH dieter_ruppert@siemens.com ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |