public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
* [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV @ 2015-04-20 22:04 dje at google dot com 2015-04-20 22:21 ` [Bug exp/18285] " sivachandra at gmail dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: dje at google dot com @ 2015-04-20 22:04 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 Bug ID: 18285 Summary: ptype expr-with-xmethod -> SEGV Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: exp Assignee: unassigned at sourceware dot org Reporter: dje at google dot com gdb unique-ptr (gdb) start (gdb) pt *foo # foo is a std::unique_ptr<> object -> segv The problem, I think, is in value_x_unop: if (noside == EVAL_AVOID_SIDE_EFFECTS) { struct type *return_type; return_type = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0]))); => return value_zero (return_type, VALUE_LVAL (arg1)); } if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD) { /* Static xmethods are not supported yet. */ gdb_assert (static_memfuncp == 0); return call_xmethod (argvec[0], 1, argvec + 1); } else return call_function_by_hand (argvec[0], nargs, argvec + 1); (top-gdb) p argvec[0]->type->main_type->code $6 = TYPE_CODE_XMETHOD xmethods don't have TYPE_TARGET_TYPE, it's NULL. The user would want the result of the ptype command to be the type of the result of the xmethod, not the type of the xmethod. Check for xmethods before EVAL_AVOID_SIDE_EFFECTS? OTOH, the xmethod may well have side effects. Propagate EVAL_AVOID_SIDE_EFFECTS into the xmethod? -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug exp/18285] ptype expr-with-xmethod -> SEGV 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com @ 2015-04-20 22:21 ` sivachandra at gmail dot com 2015-04-20 23:23 ` dje at google dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: sivachandra at gmail dot com @ 2015-04-20 22:21 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 Siva Chandra <sivachandra at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sivachandra at gmail dot com --- Comment #1 from Siva Chandra <sivachandra at gmail dot com> --- Could we extend the xmethod API to add a method XMethodWorker.return_type() and use the returned gdb.Type object to evaluate TYPE_TARGET_TYPE of an xmethod value? -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug exp/18285] ptype expr-with-xmethod -> SEGV 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com 2015-04-20 22:21 ` [Bug exp/18285] " sivachandra at gmail dot com @ 2015-04-20 23:23 ` dje at google dot com 2015-04-29 20:25 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: dje at google dot com @ 2015-04-20 23:23 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 --- Comment #2 from dje at google dot com --- A return_type method sounds good to me. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug exp/18285] ptype expr-with-xmethod -> SEGV 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com 2015-04-20 22:21 ` [Bug exp/18285] " sivachandra at gmail dot com 2015-04-20 23:23 ` dje at google dot com @ 2015-04-29 20:25 ` cvs-commit at gcc dot gnu.org 2015-05-12 16:20 ` cvs-commit at gcc dot gnu.org 2015-05-12 17:28 ` dje at google dot com 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2015-04-29 20:25 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 --- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Doug Evans <devans@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2ce1cdbf84ce883b992bc8ffec3d29b4da229b72 commit 2ce1cdbf84ce883b992bc8ffec3d29b4da229b72 Author: Doug Evans <dje@google.com> Date: Wed Apr 29 13:24:21 2015 -0700 PR python/18285 gdb/ChangeLog: PR python/18285 * NEWS: Document new gdb.XMethodWorker.get_result_type method. * eval.c (evaluate_subexp_standard) <OP_FUNCALL>: Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. * extension-priv.h (struct extension_language_ops) <get_xmethod_result_type>: New member. * extension.c (get_xmethod_result_type): New function. * extension.h (get_xmethod_result_type): Declare. * python/py-xmethods.c (get_result_type_method_name): New static global. (py_get_result_type_method_name): Ditto. (gdbpy_get_xmethod_result_type): New function. (gdbpy_initialize_xmethods): Initialize py_get_result_type_method_name. * python/python-internal.h (gdbpy_get_xmethod_result_type): Declare. * python/python.c (python_extension_ops): Add gdbpy_get_xmethod_result_type. * python/lib/gdb/xmethod.py (XMethodWorker): Add get_result_type. * valarith.c (value_x_binop): Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. (value_x_unop): Ditto. * value.c (result_type_of_xmethod): New function. * value.h (result_type_of_xmethod): Declare. gdb/testsuite/ChangeLog: * gdb.python/py-xmethods.exp: Add ptype tests. * gdb.python/py-xmethods.py (E_method_char_worker): Add get_result_type method. gdb/doc/ChangeLog: * python.texi (Xmethod API) <gdb.XMethodWorker.get_result_type>: Document. (Writing an Xmethod): Add get_result_type to example. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug exp/18285] ptype expr-with-xmethod -> SEGV 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com ` (2 preceding siblings ...) 2015-04-29 20:25 ` cvs-commit at gcc dot gnu.org @ 2015-05-12 16:20 ` cvs-commit at gcc dot gnu.org 2015-05-12 17:28 ` dje at google dot com 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2015-05-12 16:20 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 --- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The gdb-7.9-branch branch has been updated by Doug Evans <devans@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6b2a76d583a91ae9dad0653c60c91b72f07ff941 commit 6b2a76d583a91ae9dad0653c60c91b72f07ff941 Author: Doug Evans <dje@google.com> Date: Tue May 12 09:18:06 2015 -0700 PR python/18285 gdb/ChangeLog: PR python/18285 * NEWS: Document new gdb.XMethodWorker.get_result_type method. * eval.c (evaluate_subexp_standard) <OP_FUNCALL>: Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. * extension-priv.h (struct extension_language_ops) <get_xmethod_result_type>: New member. * extension.c (get_xmethod_result_type): New function. * extension.h (get_xmethod_result_type): Declare. * python/py-xmethods.c (get_result_type_method_name): New static global. (py_get_result_type_method_name): Ditto. (gdbpy_get_xmethod_result_type): New function. (gdbpy_initialize_xmethods): Initialize py_get_result_type_method_name. * python/python-internal.h (gdbpy_get_xmethod_result_type): Declare. * python/python.c (python_extension_ops): Add gdbpy_get_xmethod_result_type. * python/lib/gdb/xmethod.py (XMethodWorker): Add get_result_type. * valarith.c (value_x_binop): Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. (value_x_unop): Ditto. * value.c (result_type_of_xmethod): New function. * value.h (result_type_of_xmethod): Declare. gdb/testsuite/ChangeLog: * gdb.python/py-xmethods.exp: Add ptype tests. * gdb.python/py-xmethods.py (E_method_char_worker): Add get_result_type method. gdb/doc/ChangeLog: * python.texi (Xmethod API) <gdb.XMethodWorker.get_result_type>: Document. (Writing an Xmethod): Add get_result_type to example. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug exp/18285] ptype expr-with-xmethod -> SEGV 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com ` (3 preceding siblings ...) 2015-05-12 16:20 ` cvs-commit at gcc dot gnu.org @ 2015-05-12 17:28 ` dje at google dot com 4 siblings, 0 replies; 6+ messages in thread From: dje at google dot com @ 2015-05-12 17:28 UTC (permalink / raw) To: gdb-prs https://sourceware.org/bugzilla/show_bug.cgi?id=18285 dje at google dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from dje at google dot com --- patch committed. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-12 17:28 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-04-20 22:04 [Bug exp/18285] New: ptype expr-with-xmethod -> SEGV dje at google dot com 2015-04-20 22:21 ` [Bug exp/18285] " sivachandra at gmail dot com 2015-04-20 23:23 ` dje at google dot com 2015-04-29 20:25 ` cvs-commit at gcc dot gnu.org 2015-05-12 16:20 ` cvs-commit at gcc dot gnu.org 2015-05-12 17:28 ` dje at google dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).