This is the mail archive of the gdb-patches@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]

Re: [FYI] Inlining support, rough patch


On Sat, 27 Jun 2009 20:01:22 +0200, Daniel Jacobowitz wrote:
> On Mon, Apr 20, 2009 at 05:54:05PM +0200, Jan Kratochvil wrote:
> > Fedora also has various fixes on top of it:
> > 	http://cvs.fedora.redhat.com/viewvc/rpms/gdb/devel/gdb-6.8-inlining-addon.patch?view=co
...
> Others, particularly the testsuite changes, I don't understand.

<smile>As I did not understand how the testsuites could work before</smile>
- it is clear it was due to some compiler differences.  I should retest the
changes against FSF GCC first, my only concern was Fedora GCC for that patch.


> current_pc_is_notcurrent is interesting.  Do I have the scenario
> right?

Yes, thanks for checking it (the changed testcases cover it somewhere).

>   * function() calls inlined() calls other()
>   * finish from other()
>   * show the end of inlined() instead of the next line of function()
> 
> I can't figure out if we should do this or not.  It does seem useful.
> But that's not where we are; we're showing the previous call site
> instead of the next instruction.
> 
> I think we should consider it as a general change for finish instead
> of specific to inlining.  The comments in your patch suggested that
> too.

My goal was to:
(1) Keep non-inlined GDB behavior the same.
(2) Keep the majority of inlined cases behavior the same as non-inlined one.

For FSF GDB we should break the rule (1).

(gdb) l
1	/* 1 */ int func (void) { return 1; }
2	/* 2 */ int main (void) { int x, y;
3	/* 3 */   func ();
4	/* 4 */   y = -1;
5	/* 5 */   x = func ();
6	/* 6 */   y = 1;
7	/* 7 */   return 0; }
Temporary breakpoint 1, main () at finish.c:3
3	/* 3 */   func ();

(gdb) step
func () at finish.c:1
1	/* 1 */ int func (void) { return 1; }
(gdb) finish
Run till exit from #0  func () at finish.c:1
main () at finish.c:4
4	/* 4 */   y = -1;
Value returned is $1 = 1
### Here `finish' is at the _next_ line of the call.  I would expect rather:
###	(gdb) finish
###	Run till exit from #0  func () at finish.c:1
###	main () at finish.c:4
###	3	/* 3 */   func ();
###	Value returned is $1 = 1
### Whether this or that case is shown is also dependent on the current
### architecture - currently the behavior differs depending of whether there
### is at least one instruction of the same source line after the call
### instruction.  Next `step' will have to do _nothing_ to the inferior, just
### display the next line in GDB.

(gdb) step
5	/* 5 */   x = func ();

(gdb) step
func () at finish.c:1
1	/* 1 */ int func (void) { return 1; }
(gdb) finish
Run till exit from #0  func () at finish.c:1
0x00000000004004a0 in main () at finish.c:5
5	/* 5 */   x = func ();
Value returned is $2 = 1

(gdb) step
6	/* 6 */   y = 1;
(gdb) 


TODOlisted to submit a patch for this behavior change of non-inlined functions
(which will cover even the inlined ones).


Thanks for the merge,
Jan


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