I've only been involved with gdp for a short time and my knowledge of some of the issues is rather superficial, so I'm afraid I can't describe my questions in a very logical and professional way now. Common sense dictates that when the n command is entered under gdp, it will execute to the next statement. However, I occasionally encounter a problem where, after typing n and entering, gdp seems to be disabled and the gdp command line seems to turn into a terminal where you can type in as many characters as you like, but does not do anything with the input, just like the following:
`(gdb)
(gdb) n
[New Thread 0x7ffff724e640 (LWP 7692)]
65 if ((st.st_mode & S_IFMT) == S_IFDIR)
(gdb) n
67 if ((st.st_mode & S_IXUSR) || (st.st_mode & S_IXGRP) || (st.st_mode & S_IXOTH))
(gdb) n
69 if (!cgi)
(gdb) n
70 serve_file(client, path);
(gdb) n
n
nsdadsadsd
asdas
dasdasd
sdasd
The contents of serve_file.cpp and get_line.cpp are as follows:
#include "tinyhttp.h"
void serve_file(int client, const char *filename)
{
using std::fstream;
fstream fr(filename, fstream::in);
std::string buf;
int numchars = 1;
while ((numchars > 0) && buf != "\n")
{
numchars = get_line(client, &buf);
std::string().swap(buf);
}
if (!fr)
not_found(client);
else
{
headers(client, filename);
cat(client, fr);
}
fr.close();
}
get_line.cpp:
#include "tinyhttp.h"
int get_line(int client, std::string *buf)
{
char c = '\0';
int n;
while (c != '\n')
{
n = recv(client, &c, 1, 0);
if (n > 0)
{
if (c == '\r')
{
n = recv(client, &c, 1, MSG_PEEK);
if (n > 0 && c == '\n')
recv(client, &c, 1, 0);
else
c = '\n';
}
*buf += c;
}
else
c = '\n';
}
return (*buf).size();
}
What is this question, please?