Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5ffd0d05
Commit
5ffd0d05
authored
Dec 01, 2021
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Move YY_INPUT implementation to dbg.y.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5a94f200
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
48 deletions
+48
-48
dbg.y
programs/winedbg/dbg.y
+46
-1
debug.l
programs/winedbg/debug.l
+1
-46
debugger.h
programs/winedbg/debugger.h
+1
-1
No files found.
programs/winedbg/dbg.y
View file @
5ffd0d05
...
@@ -462,7 +462,7 @@ struct parser_context
...
@@ -462,7 +462,7 @@ struct parser_context
static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0};
static struct parser_context dbg_parser = {NULL, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, 0};
int
input_fetch_entire_line(const char* pfx, char** line)
static int
input_fetch_entire_line(const char* pfx, char** line)
{
{
char* buffer;
char* buffer;
char ch;
char ch;
...
@@ -501,6 +501,51 @@ int input_fetch_entire_line(const char* pfx, char** line)
...
@@ -501,6 +501,51 @@ int input_fetch_entire_line(const char* pfx, char** line)
return len;
return len;
}
}
size_t input_lex_read_buffer(char* buf, int size)
{
int len;
static char* last_line = NULL;
static size_t last_line_idx = 0;
/* try first to fetch the remaining of an existing line */
if (last_line_idx == 0)
{
char* tmp = NULL;
/* no remaining chars to be read from last line, grab a brand new line up to '\n' */
lexeme_flush();
len = input_fetch_entire_line("Wine-dbg>", &tmp);
if (len < 0) return 0; /* eof */
/* remove carriage return in newline */
if (len >= 2 && tmp[len - 2] == '\r')
{
tmp[len - 2] = '\n';
tmp[len - 1] = '\0';
len--;
}
/* FIXME: should have a pair of buffers, and switch between the two, instead of
* reallocating a new one for each line
*/
if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n')))
{
HeapFree(GetProcessHeap(), 0, tmp);
}
else
{
HeapFree(GetProcessHeap(), 0, last_line);
last_line = tmp;
}
}
len = min(strlen(last_line + last_line_idx), size - 1);
memcpy(buf, last_line + last_line_idx, len);
buf[len] = '\0';
if ((last_line_idx += len) >= strlen(last_line))
last_line_idx = 0;
return len;
}
int input_read_line(const char* pfx, char* buf, int size)
int input_read_line(const char* pfx, char* buf, int size)
{
{
char* line = NULL;
char* line = NULL;
...
...
programs/winedbg/debug.l
View file @
5ffd0d05
...
@@ -60,53 +60,8 @@ void lexeme_flush(void)
...
@@ -60,53 +60,8 @@ void lexeme_flush(void)
next_lexeme = 0;
next_lexeme = 0;
}
}
static size_t read_input(const char* pfx, char* buf, int size)
{
int len;
static char* last_line = NULL;
static size_t last_line_idx = 0;
/* try first to fetch the remaining of an existing line */
if (last_line_idx == 0)
{
char* tmp = NULL;
/* no remaining chars to be read from last line, grab a brand new line up to '\n' */
lexeme_flush();
len = input_fetch_entire_line(pfx, &tmp);
if (len < 0) return 0; /* eof */
/* remove carriage return in newline */
if (len >= 2 && tmp[len - 2] == '\r')
{
tmp[len - 2] = '\n';
tmp[len - 1] = '\0';
len--;
}
/* FIXME: should have a pair of buffers, and switch between the two, instead of
* reallocating a new one for each line
*/
if (last_line && (len == 0 || (len == 1 && tmp[0] == '\n')))
{
HeapFree(GetProcessHeap(), 0, tmp);
}
else
{
HeapFree(GetProcessHeap(), 0, last_line);
last_line = tmp;
}
}
len = min(strlen(last_line + last_line_idx), size - 1);
memcpy(buf, last_line + last_line_idx, len);
buf[len] = '\0';
if ((last_line_idx += len) >= strlen(last_line))
last_line_idx = 0;
return len;
}
#define YY_INPUT(buf,result,max_size) \
#define YY_INPUT(buf,result,max_size) \
(result =
read_input("Wine-dbg>",
buf, max_size))
(result =
input_lex_read_buffer(
buf, max_size))
static int syntax_error;
static int syntax_error;
%}
%}
...
...
programs/winedbg/debugger.h
View file @
5ffd0d05
...
@@ -311,7 +311,7 @@ extern int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UI
...
@@ -311,7 +311,7 @@ extern int msgbox_res_id(HWND hwnd, UINT textId, UINT captionId, UI
/* dbg.y */
/* dbg.y */
extern
void
parser_handle
(
const
char
*
,
HANDLE
);
extern
void
parser_handle
(
const
char
*
,
HANDLE
);
extern
int
input_read_line
(
const
char
*
pfx
,
char
*
buffer
,
int
size
);
extern
int
input_read_line
(
const
char
*
pfx
,
char
*
buffer
,
int
size
);
extern
int
input_fetch_entire_line
(
const
char
*
pfx
,
char
**
lin
e
);
extern
size_t
input_lex_read_buffer
(
char
*
pfx
,
int
siz
e
);
extern
HANDLE
WINAPIV
parser_generate_command_file
(
const
char
*
,
...);
extern
HANDLE
WINAPIV
parser_generate_command_file
(
const
char
*
,
...);
/* debug.l */
/* debug.l */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment