main.c -

add a char* variable 's' and assign it the string "Hello World!".

gdb.in -

line 5: changing breakpoint from main.c:4 to main.c:5, which make sure the
program stop before while loop in main.c.

Then, set a variable $pos in gdb session as a array index to access 's',
and utilizing while loop command provied by gdb to dump the content in
variable 's' to UART.

Finally, also output the content of 's' using the gdb command 'printf'.