Commit 34558cd4 authored by Bernhard Link's avatar Bernhard Link

show more details of the initial X server response

parent 7e1b30a7
2010-01-02
* fix SelectionNotify (thanks to Peter Collingbourne)
* show more details of the initial X server response
2009-10-18
* fix printing of column in protocoal description parser errors
on 64 bit architectures.
......
new after 1.0.1:
- bugfixes (SelectionNotify)
- show more details of the initial X server response
new after 1.0.0:
- bugfixes (RenderTrapezoids and server errors)
new after 1.0.0~alpha1:
......
NEEDS "requests.proto"
NEEDS "events.proto"
NEEDS "errors.proto"
NEEDS "setup.proto"
NEEDS "bigfont.proto"
NEEDS "bigrequest.proto"
......
......@@ -1553,6 +1553,8 @@ static inline void print_server_error(struct connection *c) {
}
}
const struct parameter *setup_parameters;
void parse_client(struct connection *c) {
size_t l;
bool bigrequest;
......@@ -1634,7 +1636,6 @@ void parse_server(struct connection *c) {
case s_start:
if( c->servercount/4 < 2+len )
return;
c->serverstate = s_normal;
c->serverignore = 8+4*len;
cmd = serverCARD16(0);
switch( cmd ) {
......@@ -1644,17 +1645,32 @@ void parse_server(struct connection *c) {
(int)serverCARD16(4),
(int)(4*len),
&c->serverbuffer[8]);
break;
case 2:
startline(c, TO_CLIENT, " More authentication needed, reason is '%*s'.\n",
(int)(4*len),
&c->serverbuffer[8]);
break;
case 1:
startline(c, TO_CLIENT, " Success, version is %d:%d-%d.\n",
startline(c, TO_CLIENT, " Success, version is %d:%d ",
(int)serverCARD16(2),
(int)serverCARD16(4),
(int)serverCARD16(8));
(int)serverCARD16(4));
{
unsigned long stackvalues[30];
struct stack stack;
stack.base = stackvalues;
stack.num = 30;
stack.ofs = 0;
print_parameters(c, c->serverbuffer,
c->serverignore,
setup_parameters,
false, &stack);
putc('\n',out);
}
c->serverstate = s_normal;
break;
}
return;
case s_normal:
if( c->servercount < 32 )
......
......@@ -130,6 +130,7 @@ extern size_t num_errors;
extern const struct extension *extensions;
extern size_t num_extensions;
extern const struct parameter *unexpected_reply;
extern const struct parameter *setup_parameters;
bool requestQueryExtension(struct connection *c, bool pre, bool bigrequest UNUSED, struct expectedreply *reply);
bool requestInternAtom(struct connection *c, bool pre, bool bigrequest UNUSED, struct expectedreply *reply);
......
# This file is part of xtrace
# Copyright (C) 2010 Bernhard R. Link
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not write to the Free Software
# Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
NAMESPACE core
CONSTANTS visualtypeclass
0 StaticGray
1 GrayScale
2 StaticColor
3 PseudoColor
4 TrueColor
5 DirectColor
END
LIST VISUALTYPE length 24
0 id CARD32
4 class ENUM8 visualtypeclass
5 bits/rgb-value UINT8
6 colormap-entries UINT16
8 red-mask CARD32
12 green-mask CARD32
16 blue-mask CARD32
#20 pad CARD32
END
LIST DEPTH variable min-length 8
0 depth UINT8
2 "#types" COUNT16
8 visuals LISTofVISUALTYPE
END
CONSTANTS backingstore
0 Never
1 WhenMapped
2 Always
END
LIST SCREEN variable min-length 40
0 root WINDOW
4 default-colormap COLORMAP
8 white-pixel CARD32
12 black-pixel CARD32
16 input-mask SETofEVENT
20 width[pixel] UINT16
22 height[pixel] UINT16
24 width[mm] UINT16
26 height[mm] UINT16
28 min-installed-maps UINT16
30 max-installed-maps UINT16
32 root VISUALID
36 backing-stores ENUM8 backingstore
37 save-unders BOOL
38 root-depth UINT8
39 "#depths" COUNT8
40 "allowed depths" LISTofDEPTH
END
LIST FORMAT length 8
0 depth UINT8
1 bits/pixel UINT8
2 scanline-pad UINT8
END
CONSTANTS lsbmsb
0 LSBFirst
1 MSBFirst
END
CONSTANTS lsms
0 LeastSignificant
1 MostSignificant
END
SETUP
24 len(vendor) COUNT16
40 vendor STRING8
ROUND
8 release UINT32
12 resource-id CARD32
16 resource-mask CARD32
20 motion-buffer-size UINT32
26 max-request-len UINT16
30 image-byte-order ENUM8 lsbmsb
31 bitmap-bit-order ENUM8 lsms
32 scanline-unit UINT8
33 scanline-pad UINT8
34 min-keycode KEYCODE
36 max-keycode KEYCODE
29 "#formats" COUNT8
LATER pixmap-formats LISTofFORMAT
28 "#screens" COUNT8
LATER roots LISTofSCREEN
END
EOF
......@@ -39,7 +39,7 @@
/* This parses an file to generate the description how packets look like.
*/
enum variable_type { vt_namespace = 0, vt_request, vt_response, vt_event, vt_type, vt_constants, vt_values, vt_struct, vt_COUNT };
enum variable_type { vt_namespace = 0, vt_request, vt_response, vt_event, vt_setup, vt_type, vt_constants, vt_values, vt_struct, vt_COUNT };
static const char * const typename[vt_COUNT] = {
"namespace", "request", "response", "event", "type", "constants", "values", "struct"};
......@@ -186,6 +186,7 @@ struct namespace {
} *events;
int num_errors;
const char **errors;
struct variable *setup;
void *variables[vt_COUNT];
/* namespaces that can be used without prefix: */
int used_count;
......@@ -246,6 +247,7 @@ static void variable_unref(struct variable *v) {
} else if( v->type == vt_type ) {
typespec_done(&v->t);
} else if( v->type == vt_struct || v->type == vt_request
|| v->type == vt_setup
|| v->type == vt_response || v->type == vt_event ) {
parameter_free(v->parameter);
} else
......@@ -1288,6 +1290,34 @@ static void parse_request(struct parser *parser, bool template) {
parse_parameters(parser, v, false);
}
static void parse_setup(struct parser *parser) {
const char *attribute;
struct variable *v = NULL;
struct namespace *n = parser->current->namespace;
assert( n != NULL );
if( n->extension != NULL || strcmp(n->name, "core") != 0 ) {
error(parser, "'SETUP' only allowed in namespace 'core'!");
return;
}
if( n->setup != NULL ) {
error(parser, "multiple 'SETUP' in the same namespace!");
return;
}
while( (attribute = get_const_token(parser, true)) != NULL ) {
error(parser, "Unknown SETUP attribute '%s'!",
attribute);
return;
}
v = add_var(parser, "", "setup", NULL, vt_setup);
if( v == NULL )
return;
n->setup = v;
v->refcount ++;
parse_parameters(parser, v, false);
}
static void parse_response(struct parser *parser, bool template) {
const char *name, *attribute;
struct variable *v = NULL;
......@@ -1996,6 +2026,8 @@ bool translate(struct parser *parser, const char *name) {
error(parser, "First command must be EXTENSION or NAMESPACE!");
} else if( command_is("USE") ) {
parse_use(parser);
} else if( command_is("SETUP") ) {
parse_setup(parser);
} else if( command_is("REQUESTS") ) {
parse_requests(parser);
} else if( command_is("EVENTS") ) {
......@@ -2064,6 +2096,8 @@ bool parser_free(struct parser *parser) {
for( i = 0 ; i < ns->num_events ; i++ ) {
variable_unref(ns->events[i].event);
}
if( ns->setup != NULL )
variable_unref(ns->setup);
free(ns->events);
free(ns->errors);
free(ns->used);
......@@ -2172,6 +2206,7 @@ static const void *variable_finalize(struct parser *parser, struct variable *v)
return v->finalized;
}
if( v->type == vt_struct || v->type == vt_response ||
v->type == vt_setup ||
v->type == vt_request || v->type == vt_event ) {
struct unfinished_parameter *p, *todo, *startat;
do {
......@@ -2343,6 +2378,11 @@ void finalize_everything(struct parser *parser) {
parser->error = true;
return;
}
if( core->setup == NULL ) {
fputs("No setup parser defined!\n", stderr);
parser->error = true;
return;
}
v = find_variable(parser, vt_request, "core::unknown");
unknownrequest = variable_finalize(parser, v);
v = find_variable(parser, vt_response, "core::unknown");
......@@ -2401,6 +2441,7 @@ void finalize_everything(struct parser *parser) {
if( errors == NULL )
parser->error = true;
num_errors = core->num_errors;
setup_parameters = variable_finalize(parser, core->setup);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment