Skip to content

Commit

Permalink
gdb:
Browse files Browse the repository at this point in the history
	* NEWS: Mention OpenCL C language support.
	* Makefile.in (SFILES): Add opencl-lang.c.
	(COMMON_OBS): Add opencl-lang.o.
	* opencl-lang.c: New File
	* defs.h (enum language): Add language_opencl.
	* dwarf2read.c (read_file_scope): Handle DW_AT_producer for the
	IBM XL C OpenCL compiler.
	* c-lang.h: Include "parser-defs.h".
	(evaluate_subexp_c): Declare.
	* c-lang.c (evaluate_subexp_c): Remove the static qualifier.
	(c_op_print_tab): Add declaration.
	* eval.c (binop_promote): Handle language_opencl.
	* c-exp.y: Lookup the primitive types instead of referring to the
	builtins.

gdb/testsuite:
	* Makefile.in (ALL_SUBDIRS): Add gdb.opencl.
	* configure.ac (AC_OUTPUT): Add gdb.opencl/Makefile.
	* configure: Regenerate.
	* gdb.opencl/Makefile.in: New File.
	* gdb.opencl/datatypes.exp: Likewise.
	* gdb.opencl/datatypes.cl: Likewise.
	* gdb.opencl/operators.exp: Likewise.
	* gdb.opencl/operators.cl: Likewise.
	* gdb.opencl/vec_comps.exp: Likewise.
	* gdb.opencl/vec_comps.cl: Likewise.
	* gdb.opencl/convs_casts.exp: Likewise.
	* gdb.opencl/convs_casts.cl: Likewise.
	* lib/opencl.exp: Likewise.
	* lib/opencl_hostapp.c: Likewise.
	* lib/opencl_kernel.cl: Likewise.
	* lib/cl_util.c: Likewise.
	* lib/cl_util.c: Likewise.
	* gdb.base/default.exp (set language): Add "opencl" to the list of
	languages.

gdb/doc:
	* gdb.texinfo: (Summary) Add mention about OpenCL C language support.
	(OpenCL C): New node.
  • Loading branch information
kwerner committed Nov 5, 2010
1 parent 48f09c3 commit 100d4cd
Show file tree
Hide file tree
Showing 31 changed files with 4,550 additions and 43 deletions.
17 changes: 17 additions & 0 deletions gdb/ChangeLog
@@ -1,3 +1,20 @@
2010-11-05 Ken Werner <ken.werner@de.ibm.com>

* NEWS: Mention OpenCL C language support.
* Makefile.in (SFILES): Add opencl-lang.c.
(COMMON_OBS): Add opencl-lang.o.
* opencl-lang.c: New File
* defs.h (enum language): Add language_opencl.
* dwarf2read.c (read_file_scope): Handle DW_AT_producer for the
IBM XL C OpenCL compiler.
* c-lang.h: Include "parser-defs.h".
(evaluate_subexp_c): Declare.
* c-lang.c (evaluate_subexp_c): Remove the static qualifier.
(c_op_print_tab): Add declaration.
* eval.c (binop_promote): Handle language_opencl.
* c-exp.y: Lookup the primitive types instead of referring to the
builtins.

2010-11-05 Jan Kratochvil <jan.kratochvil@redhat.com>

Fix configure --enable-plugins --without-python.
Expand Down
3 changes: 2 additions & 1 deletion gdb/Makefile.in
Expand Up @@ -689,6 +689,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
mi/mi-common.c \
objc-exp.y objc-lang.c \
objfiles.c osabi.c observer.c osdata.c \
opencl-lang.c \
p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c printcmd.c \
proc-service.list progspace.c \
prologue-value.c psymtab.c \
Expand Down Expand Up @@ -845,7 +846,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
ui-out.o cli-out.o \
varobj.o vec.o wrapper.o \
jv-lang.o jv-valprint.o jv-typeprint.o \
m2-lang.o p-lang.o p-typeprint.o p-valprint.o \
m2-lang.o opencl-lang.o p-lang.o p-typeprint.o p-valprint.o \
sentinel-frame.o \
complaints.o typeprint.o \
ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o \
Expand Down
4 changes: 4 additions & 0 deletions gdb/NEWS
Expand Up @@ -3,6 +3,10 @@

*** Changes since GDB 7.2

* OpenCL C
Initial support for the OpenCL C language (http://www.khronos.org/opencl)
has been integrated into GDB.

* Python scripting

** GDB values in Python are now callable if the value represents a
Expand Down
136 changes: 102 additions & 34 deletions gdb/c-exp.y
Expand Up @@ -612,7 +612,9 @@ exp : VARIABLE

exp : SIZEOF '(' type ')' %prec UNARY
{ write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (parse_type->builtin_int);
write_exp_elt_type (lookup_signed_typename
(parse_language, parse_gdbarch,
"int"));
CHECK_TYPEDEF ($3);
write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3));
write_exp_elt_opcode (OP_LONG); }
Expand Down Expand Up @@ -980,61 +982,117 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
: TYPENAME
{ $$ = $1.type; }
| INT_KEYWORD
{ $$ = parse_type->builtin_int; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"int"); }
| LONG
{ $$ = parse_type->builtin_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long"); }
| SHORT
{ $$ = parse_type->builtin_short; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"short"); }
| LONG INT_KEYWORD
{ $$ = parse_type->builtin_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long"); }
| LONG SIGNED_KEYWORD INT_KEYWORD
{ $$ = parse_type->builtin_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long"); }
| LONG SIGNED_KEYWORD
{ $$ = parse_type->builtin_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long"); }
| SIGNED_KEYWORD LONG INT_KEYWORD
{ $$ = parse_type->builtin_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long"); }
| UNSIGNED LONG INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long"); }
| LONG UNSIGNED INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long"); }
| LONG UNSIGNED
{ $$ = parse_type->builtin_unsigned_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long"); }
| LONG LONG
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| LONG LONG INT_KEYWORD
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| LONG LONG SIGNED_KEYWORD INT_KEYWORD
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| LONG LONG SIGNED_KEYWORD
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| SIGNED_KEYWORD LONG LONG
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| SIGNED_KEYWORD LONG LONG INT_KEYWORD
{ $$ = parse_type->builtin_long_long; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"long long"); }
| UNSIGNED LONG LONG
{ $$ = parse_type->builtin_unsigned_long_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long long"); }
| UNSIGNED LONG LONG INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_long_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long long"); }
| LONG LONG UNSIGNED
{ $$ = parse_type->builtin_unsigned_long_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long long"); }
| LONG LONG UNSIGNED INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_long_long; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"long long"); }
| SHORT INT_KEYWORD
{ $$ = parse_type->builtin_short; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"short"); }
| SHORT SIGNED_KEYWORD INT_KEYWORD
{ $$ = parse_type->builtin_short; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"short"); }
| SHORT SIGNED_KEYWORD
{ $$ = parse_type->builtin_short; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"short"); }
| UNSIGNED SHORT INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_short; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"short"); }
| SHORT UNSIGNED
{ $$ = parse_type->builtin_unsigned_short; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"short"); }
| SHORT UNSIGNED INT_KEYWORD
{ $$ = parse_type->builtin_unsigned_short; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"short"); }
| DOUBLE_KEYWORD
{ $$ = parse_type->builtin_double; }
{ $$ = lookup_typename (parse_language, parse_gdbarch,
"double", (struct block *) NULL,
0); }
| LONG DOUBLE_KEYWORD
{ $$ = parse_type->builtin_long_double; }
{ $$ = lookup_typename (parse_language, parse_gdbarch,
"long double",
(struct block *) NULL, 0); }
| STRUCT name
{ $$ = lookup_struct (copy_name ($2),
expression_context_block); }
Expand All @@ -1052,13 +1110,17 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
parse_gdbarch,
TYPE_NAME($2.type)); }
| UNSIGNED
{ $$ = parse_type->builtin_unsigned_int; }
{ $$ = lookup_unsigned_typename (parse_language,
parse_gdbarch,
"int"); }
| SIGNED_KEYWORD typename
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
TYPE_NAME($2.type)); }
| SIGNED_KEYWORD
{ $$ = parse_type->builtin_int; }
{ $$ = lookup_signed_typename (parse_language,
parse_gdbarch,
"int"); }
/* It appears that this rule for templates is never
reduced; template recognition happens by lookahead
in the token processing code in yylex. */
Expand All @@ -1077,19 +1139,25 @@ typename: TYPENAME
{
$$.stoken.ptr = "int";
$$.stoken.length = 3;
$$.type = parse_type->builtin_int;
$$.type = lookup_signed_typename (parse_language,
parse_gdbarch,
"int");
}
| LONG
{
$$.stoken.ptr = "long";
$$.stoken.length = 4;
$$.type = parse_type->builtin_long;
$$.type = lookup_signed_typename (parse_language,
parse_gdbarch,
"long");
}
| SHORT
{
$$.stoken.ptr = "short";
$$.stoken.length = 5;
$$.type = parse_type->builtin_short;
$$.type = lookup_signed_typename (parse_language,
parse_gdbarch,
"short");
}
;

Expand Down
2 changes: 1 addition & 1 deletion gdb/c-lang.c
Expand Up @@ -933,7 +933,7 @@ parse_one_string (struct obstack *output, char *data, int len,
are delegated to evaluate_subexp_standard; see that function for a
description of the arguments. */

static struct value *
struct value *
evaluate_subexp_c (struct type *expect_type, struct expression *exp,
int *pos, enum noside noside)
{
Expand Down
7 changes: 7 additions & 0 deletions gdb/c-lang.h
Expand Up @@ -27,6 +27,7 @@ struct language_arch_info;

#include "value.h"
#include "macroexp.h"
#include "parser-defs.h"


/* The various kinds of C string and character. Note that these
Expand Down Expand Up @@ -78,6 +79,10 @@ extern int c_value_print (struct value *, struct ui_file *,

/* These are in c-lang.c: */

extern struct value *evaluate_subexp_c (struct type *expect_type,
struct expression *exp, int *pos,
enum noside noside);

extern void c_printchar (int, struct type *, struct ui_file *);

extern void c_printstr (struct ui_file * stream, struct type *elttype,
Expand All @@ -93,6 +98,8 @@ extern const struct exp_descriptor exp_descriptor_c;
extern void c_emit_char (int c, struct type *type,
struct ui_file *stream, int quoter);

extern const struct op_print c_op_print_tab[];

/* These are in c-typeprint.c: */

extern void c_type_print_base (struct type *, struct ui_file *, int, int);
Expand Down
1 change: 1 addition & 0 deletions gdb/defs.h
Expand Up @@ -201,6 +201,7 @@ enum language
language_asm, /* Assembly language */
language_pascal, /* Pascal */
language_ada, /* Ada */
language_opencl, /* OpenCL */
language_minimal, /* All other languages, minimal support only */
nr_languages
};
Expand Down
5 changes: 5 additions & 0 deletions gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
2010-11-05 Ken Werner <ken.werner@de.ibm.com>

* gdb.texinfo: (Summary) Add mention about OpenCL C language support.
(OpenCL C): New node.

2010-11-02 Doug Evans <dje@google.com>

* gdb.texinfo (Pretty Printing): Expand into three sections,
Expand Down
42 changes: 41 additions & 1 deletion gdb/doc/gdb.texinfo
Expand Up @@ -221,6 +221,9 @@ Support for D is partial. For information on D, see
Support for Modula-2 is partial. For information on Modula-2, see
@ref{Modula-2,,Modula-2}.

Support for OpenCL C is partial. For information on OpenCL C, see
@ref{OpenCL C,,OpenCL C}.

@cindex Pascal
Debugging Pascal programs which use sets, subranges, file variables, or
nested functions does not currently work. @value{GDBN} does not support
Expand Down Expand Up @@ -11611,7 +11614,7 @@ being set automatically by @value{GDBN}.
@node Supported Languages
@section Supported Languages

@value{GDBN} supports C, C@t{++}, D, Objective-C, Fortran, Java, Pascal,
@value{GDBN} supports C, C@t{++}, D, Objective-C, Fortran, Java, OpenCL C, Pascal,
assembly, Modula-2, and Ada.
@c This is false ...
Some @value{GDBN} features may be used in expressions regardless of the
Expand All @@ -11632,6 +11635,7 @@ language reference or tutorial.
* C:: C and C@t{++}
* D:: D
* Objective-C:: Objective-C
* OpenCL C:: OpenCL C
* Fortran:: Fortran
* Pascal:: Pascal
* Modula-2:: Modula-2
Expand Down Expand Up @@ -12278,6 +12282,42 @@ the description of an object. However, this command may only work
with certain Objective-C libraries that have a particular hook
function, @code{_NSPrintForDebugger}, defined.

@node OpenCL C
@subsection OpenCL C

@cindex OpenCL C
This section provides information about @value{GDBN}s OpenCL C support.

@menu
* OpenCL C Datatypes::
* OpenCL C Expressions::
* OpenCL C Operators::
@end menu

@node OpenCL C Datatypes
@subsubsection OpenCL C Datatypes

@cindex OpenCL C Datatypes
@value{GDBN} supports the builtin scalar and vector datatypes specified
by OpenCL 1.1. In addition the half- and double-precision floating point
data types of the @code{cl_khr_fp16} and @code{cl_khr_fp64} OpenCL
extensions are also known to @value{GDBN}.

@node OpenCL C Expressions
@subsubsection OpenCL C Expressions

@cindex OpenCL C Expressions
@value{GDBN} supports accesses to vector components including the access as
lvalue where possible. Since OpenCL C is based on C99 most C expressions
supported by @value{GDBN} can be used as well.

@node OpenCL C Operators
@subsubsection OpenCL C Operators

@cindex OpenCL C Operators
@value{GDBN} supports the operators specified by OpenCL 1.1 for scalar and
vector data types.

@node Fortran
@subsection Fortran
@cindex Fortran-specific support in @value{GDBN}
Expand Down
6 changes: 6 additions & 0 deletions gdb/dwarf2read.c
Expand Up @@ -5089,6 +5089,12 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr)
cu->producer = DW_STRING (attr);

/* The XLCL doesn't generate DW_LANG_OpenCL because this attribute is not
standardised yet. As a workaround for the language detection we fall
back to the DW_AT_producer string. */
if (cu->producer && strstr (cu->producer, "IBM XL C for OpenCL") != NULL)
cu->language = language_opencl;

/* We assume that we're processing GCC output. */
processing_gcc_compilation = 2;

Expand Down

0 comments on commit 100d4cd

Please sign in to comment.