gdb: fail for 'maint print frame-id LEVEL' of an invalid frame
I noticed that 'maint print frame-id LEVEL' will always print a
frame-id, just not always for LEVEL, for example:
(gdb) bt
#0 woof () at stack.c:4
#1 0x000000000040111f in bar () at stack.c:10
#2 0x000000000040112f in foo () at stack.c:16
#3 0x000000000040113f in main () at stack.c:22
(gdb) maintenance print frame-id 4
frame-id for frame #3: {stack=0x7fffffffa640,code=0x0000000000401131,!special}
(gdb)
Notice that the request was for the frame-id of #4, which doesn't
exist, but what I got was the frame-id for #3.
Fix this by adding a check to maintenance_print_frame_id (frame.c), so
the new behaviour is:
(gdb) maintenance print frame-id 4
No frame at level 4.
(gdb)
This matches the behaviour of the 'frame' command:
(gdb) frame 4
No frame at level 4.
(gdb)
I've added a new test to cover this case.
Approved-By: Simon Marchi <simon.marchi@efficios.com>