There are many solutions to this problem, but I'm going to assume you are not using curses or terminal libraries.
With gdb, break just after the getline (..) statement as see what the input buffer contains and then formulate your code based on that. For example let's say pressing F3 sends a 3 byte combination (EC 7F 03). Then
switch (Buffer [0]) {
case 0xEC:
; Because a function key always has 3 bytes we might assume next is 7F.
if (Buffer [2] == 3) {
; Do whatever is required base on F3 key
}
}
NOTE: This code doesn't represent actual circumstanses but rather how the key combination could be trapped base on this hypothetical situaltion.