public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Pouget <kevin.pouget@gmail.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Python Finish Breakpoints
Date: Sun, 18 Dec 2011 19:22:00 -0000	[thread overview]
Message-ID: <CAPftXUKL-HFAgRWy8WGhq3fxpjH7ZFQkeWk_+Q3qdr87C+c2cA@mail.gmail.com> (raw)
In-Reply-To: <CAPftXU+ck+RVjxBZba6YEQa+yOMj1sPrD=k21aKXzbWevH6epg@mail.gmail.com>

On Fri, Dec 9, 2011 at 10:31 AM, Kevin Pouget <kevin.pouget@gmail.com> wrote:
>
> On Thu, Dec 8, 2011 at 5:09 PM, Kevin Pouget <kevin.pouget@gmail.com> wrote:
> > On Thu, Dec 8, 2011 at 4:33 PM, Kevin Pouget <kevin.pouget@gmail.com> wrote:
> >> On Thu, Dec 8, 2011 at 3:56 PM, Tom Tromey <tromey@redhat.com> wrote:
> >>>>>>>> "Kevin" == Kevin Pouget <kevin.pouget@gmail.com> writes:
> >>>
> >>> Kevin> and we're .... not ready!
> >>> Kevin> there are some regressions this morning, certainly due to your
> >>> Kevin> ambiguous linespec patch!
> >>>
> >>> Kevin> first one is quite obvious:
> >>>
> >>> Kevin> a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
> >>> Kevin> -if ![runto "getpid"] then {
> >>> Kevin> -    fail "Cannot run to getpid."
> >>> Kevin> +if ![runto_main] then {
> >>> Kevin> +    fail "Cannot run to main."     return 0 }
> >>> Kevin> +gdb_breakpoint "getpid" {temporary}
> >>> Kevin> +gdb_test "continue" "Temporary breakpoint .*in getpid.*" "continue to getpid"
> >>> Kevin> +
> >>>
> >>> Kevin> "break getpid" used to work before actually starting the inferior, but
> >>> Kevin> now it's unresolved
> >>>
> >>> This test assumes that there is no debuginfo for getpid -- but in my
> >>> case, I have glibc debuginfo installed.  This isn't unheard of for gdb
> >>> developers :)
> >>>
> >>> The test would be more robust if you put a new function in a new file
> >>> and arranged for that file to be compiled without debuginfo.
> >>>
> >>> Sorry I didn't notice this before.
> >>
> >> I'll work on that, thanks for noticing it
> >>
> >>> Kevin> bpfinishpy_out_of_scope can't be triggered anymore because you set
> >>> Kevin> b-> pspace to NULL. I hesitated about how to fix it, but I think that
> >>> Kevin> FinishBP have to be bound to the pspace in which they were set, so I
> >>> Kevin> added this line:
> >>>
> >>> It seems to me that one of these breakpoints has to be thread-specific
> >>> as well.  Maybe the code to set b->pspace should notice thread-specific
> >>> breakpoints and allow pspace to be set there.
> >>>
> >>> I'd rather this be done in breakpoint.c than have other modules modify
> >>> struct breakpoint directly.
> >>>
> >>> Tom
> >>
> >> you're right about thread-specific, but I'm not sure how to enforce
> >> it. Currently, FinishBreakpoint only accepts a frame as parameter, and
> >> a frame is only bound to a pspace, not a thread ...
> >>
> >> My code
> >>> self_bpfinish->py_bp.bp->pspace = current_program_space;
> >> was wrong, it should rather be
> >>> pspace = get_frame_program_space (prev_frame);
> >> and this also implies that we can't really defer this setting to
> >> another place ...
> >>
> >> Maybe we can state in the documentation that FinishBreakpoint will be
> >> created by default in the selected thread, and add another parameter
> >> in the constructor to specify another thread?
> >
> > so it was not possible to allow the user to specify the thread as I
> > suggest, for the reason I mentioned two lines above ... :(
> > I added this line to the doc to express it:
> >
> >> Finish breakpoints are thread specific and must be create with the right
> >> thread selected.
> >
> >
> > cordially,
> >
> > Kevin
> >
> > (I'll send getpid fix tomorrow)
>
> here is a fix for the getpid problem you noticed yesterday,
> I now compile the existing py-events-shlib.c into
> py-events-shlib-nodebug.so, ensure that it has no debug info, and
> continue as before.
>
> I also changed
> -set remote_python_file [remote_download host
> ${srcdir}/${subdir}/${testfile}.py]
> +set python_file  ${srcdir}/${subdir}/${testfile}.py
> as I think it was not really necessary
>
> I also added
>        * Makefile.in (EXECUTABLES): Add py-finish-breakpoint and
>        py-finish-breakpoint2
>        (MISCELLANEOUS): Add py-events-shlib.so and py-events-shlib-nodebug.so
> to allow cleaning up the testsuite files (cf. below)
>
>
> Finally, I switched
>
> +# Start with a fresh gdb.
> +gdb_exit
> +gdb_start
> +gdb_reinitialize_dir $srcdir/$subdir
> +gdb_load ${binfile}
>
> and
>
> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}"
> executable {debug c++}] != "" } {
> +    untested "Couldn't compile ${srcfile}"
> +    return -1
> +}
>
> in testsuite/gdb.python/py-finish-breakpoint2.exp, because it leaded
> to an intermittent ERROR (1st run would fail, next ones would be
> successful) -- my testsuite test harness doesn't consider this
> situation ...
>
>
> Cordially,
>
> Kevin
>
> as far as I could test, there is no regression against the current git
> tree (x86_64/Fedora)
>
> --
>
> 2011-12-09  Kevin Pouget  <kevin.pouget@st.com>
>
>        Introduce gdb.FinishBreakpoint in Python
>
>        * Makefile.in (SUBDIR_PYTHON_OBS): Add py-finishbreakpoint.o.
>        (SUBDIR_PYTHON_SRCS): Add python/py-finishbreakpoint.c.
>        Add build rule for this file.
>        * infcmd.c (print_return_value): Split to create get_return_value.
>        (get_return_value): New function based on print_return_value. Handle
>        case where stop_registers are not set.
>        * inferior.h (get_return_value): New prototype.
>        * python/py-breakpoint.c (bppy_pending_object): Make non-static.
>        (gdbpy_breakpoint_created): Set is_py_finish_bp is necessary.
>        (struct breakpoint_object): Move to python-internal.h
>        (BPPY_REQUIRE_VALID): Likewise.
>        (BPPY_SET_REQUIRE_VALID): Likewise.
>        (gdbpy_breakpoint_created): Initialize is_finish_bp.
>        (gdbpy_should_stop): Add  pre/post hooks before/after calling stop
>        method.
>        * python/python-internal.h (breakpoint_object_type): Add as extern.
>        (bppy_pending_object): Likewise.
>        (typedef struct breakpoint_object) Removed.
>        (struct breakpoint_object): Moved from py-breakpoint.c.
>        Add field is_finish_bp.
>        (BPPY_REQUIRE_VALID): Moved from py-breakpoint.c.
>        (BPPY_SET_REQUIRE_VALID): Likewise.
>        (frame_object_to_frame_info): New prototype.
>        (gdbpy_initialize_finishbreakpoints): New prototype.
>        (bpfinishpy_is_finish_bp): Likewise.
>        (bpfinishpy_pre_stop_hook): Likewise.
>        (bpfinishpy_post_stop_hook): Likewise.
>        * python/py-finishbreakpoint.c: New file.
>        * python/py-frame.c(frame_object_to_frame_info): Make non-static and
>        accept PyObject instead of frame_object.
>        (frapy_is_valid): Don't cast to frame_object.
>        (frapy_name): Likewise.
>        (frapy_type): Likewise.
>        (frapy_unwind_stop_reason): Likewise.
>        (frapy_pc): Likewise.
>        (frapy_block): Likewise.
>        (frapy_function): Likewise.
>        (frapy_older): Likewise.
>        (frapy_newer): Likewise.
>        (frapy_find_sal): Likewise.
>        (frapy_read_var): Likewise.
>        (frapy_select): Likewise.
>        * python/python.c (gdbpy_is_stopped_at_finish_bp): New noop function.
>        (_initialize_python): Add gdbpy_initialize_finishbreakpoints.
>        * python/python.h: Include breakpoint.h
>        (gdbpy_is_stopped_at_finish_bp): New prototype.
>
> doc/
>        * gdb.texinfo (Finish Breakpoints in Python): New subsection.
>        (Python API): Add menu entry for Finish Breakpoints.
>
> testsuite/
>        * gdb.python/py-breakpoint.exp (mult_line): Define and use variable
>        instead of line number.
>        * gdb.python/py-finish-breakpoint.c: New file.
>        * gdb.python/py-finish-breakpoint.exp: New file.
>        * gdb.python/py-finish-breakpoint.py: New file.
>        * gdb.python/py-finish-breakpoint2.cc: New file.
>        * gdb.python/py-finish-breakpoint2.exp: New file.
>        * gdb.python/py-finish-breakpoint2.py: New file.


ping

  reply	other threads:[~2011-12-18 19:13 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTim+YH64zkWvdz2_kVUUj=AJ7v4LKw@mail.gmail.com>
     [not found] ` <BANLkTi=gtHzWzXOJzB+a19=jkfk1hGwQBg@mail.gmail.com>
     [not found]   ` <BANLkTikVdqbMqjguTV8ct0TWiBDhHGYtLg@mail.gmail.com>
2011-05-11  7:44     ` Kevin Pouget
2011-05-11 10:31       ` Phil Muldoon
2011-05-11 11:29         ` Kevin Pouget
2011-05-12 10:38           ` Kevin Pouget
2011-05-12 10:50         ` Phil Muldoon
2011-05-12 11:29           ` Kevin Pouget
     [not found] ` <BANLkTi=Eu-5B4YyhP2rGdQXgXbBN-EmLKA@mail.gmail.com>
     [not found]   ` <BANLkTikt2hEUcXkGVH44NaUcwiF1SGdMaw@mail.gmail.com>
     [not found]     ` <BANLkTi=UpgogckTD5MZsW+PC5d2F8X-+jA@mail.gmail.com>
     [not found]       ` <BANLkTi==bj50mZgFKq_qA-+3-2CQA3tBVw@mail.gmail.com>
     [not found]         ` <BANLkTimmYEmvKT_984jYEVZnA5RGFpEgNw@mail.gmail.com>
2011-05-19 16:21           ` Tom Tromey
2011-05-24 12:51             ` Kevin Pouget
2011-05-27 20:30               ` Tom Tromey
2011-05-30  9:29                 ` Kevin Pouget
2011-10-13 14:34                   ` Kevin Pouget
2011-10-20 20:12                     ` Tom Tromey
2011-10-20 20:58                   ` Tom Tromey
2011-10-21  8:15                     ` Kevin Pouget
2011-10-24 11:43                       ` Kevin Pouget
2011-10-24 13:20                         ` Eli Zaretskii
2011-10-24 14:30                           ` Kevin Pouget
2011-10-24 17:14                             ` Eli Zaretskii
2011-10-24 15:31                         ` Kevin Pouget
2011-10-24 16:27                           ` Phil Muldoon
2011-10-25 11:05                             ` Kevin Pouget
2011-10-25 11:37                               ` Phil Muldoon
2011-10-25 12:22                                 ` Kevin Pouget
2011-10-28  8:33                                   ` Kevin Pouget
2011-10-28 20:51                                     ` Tom Tromey
2011-11-02 14:44                                       ` Kevin Pouget
2011-11-04 14:25                                         ` Kevin Pouget
2011-11-04 21:04                                           ` Tom Tromey
2011-11-09 14:10                                             ` Kevin Pouget
2011-11-16 10:53                                               ` Kevin Pouget
2011-11-17 17:49                                                 ` Tom Tromey
2011-11-17 17:48                                               ` Tom Tromey
     [not found]                                                 ` <CAPftXUJwtGJhqFyfX6LVK87QH2xeLkvv5kx=yaEnYJMv0YR_rw@mail.gmail.com>
2011-11-24  8:27                                                   ` Kevin Pouget
2011-11-30 16:02                                                     ` Kevin Pouget
2011-12-02 21:49                                                       ` Tom Tromey
2011-12-05  9:29                                                         ` Kevin Pouget
2011-12-06 21:18                                                           ` Tom Tromey
2011-12-07 13:35                                                             ` Kevin Pouget
2011-12-08 15:30                                                               ` Tom Tromey
2011-12-08 16:10                                                                 ` Kevin Pouget
2011-12-08 18:08                                                                   ` Kevin Pouget
2011-12-09  9:53                                                                     ` Kevin Pouget
2011-12-18 19:22                                                                       ` Kevin Pouget [this message]
2011-12-20 20:55                                                                       ` Tom Tromey
2011-12-20 20:58                                                                         ` Kevin Pouget
2011-12-21  7:16                                                                           ` Joel Brobecker
2011-12-21 17:13                                                                             ` Tom Tromey
     [not found]                                                                               ` <CAPftXUKXh9ekZ2kiwQ=5zbrjst+9VH9-eZk8h+Z-9SpQ1WqdLw@mail.gmail.com>
     [not found]                                                                                 ` <CAPftXULQFggY3Nz2byC0fMZA1sg4Nymp3hAhe8aSuLNG4cauFg@mail.gmail.com>
     [not found]                                                                                   ` <CAPftXUJALHd=-fajVwgowqfCDfXO6JMxSkorWD6CQArsg-PedQ@mail.gmail.com>
     [not found]                                                                                     ` <CAPftXULKC8gp3L87+PZEF3dj3crv9bh-uzZpRiYKjqEw_xyptQ@mail.gmail.com>
2011-12-27  4:18                                                                                       ` Joel Brobecker
2011-12-27  9:40                                                                                         ` Kevin Pouget
2011-12-27 12:22                                                                                           ` Joel Brobecker
2011-12-27  9:34                                                                                       ` Kevin Pouget
2011-12-24 23:56                                                                           ` [patch] Fix gdb.python/py-finish-breakpoint.exp new FAIL on x86_64-m32 [Re: [RFC] Python Finish Breakpoints] Jan Kratochvil
2011-12-27 11:13                                                                             ` Kevin Pouget
2011-12-27 21:39                                                                               ` [commit] " Jan Kratochvil
2012-01-04 17:45                                                                             ` Ulrich Weigand
2012-01-04 17:58                                                                               ` [commit 7.4] " Jan Kratochvil
2012-01-04 18:10                                                                                 ` Ulrich Weigand
2011-12-26 11:28                                                                           ` [patch] Fix remote.c crash on gdbserver close (+fix py-finish-breakpoint.exp for gdbserver) " Jan Kratochvil
2011-12-27 23:30                                                                             ` [patch] Fix remote.c crash on gdbserver close (+fix py-finish-breakpoint.exp for gdbserver) [rediff] Jan Kratochvil
2012-01-02 17:57                                                                               ` Tom Tromey
2012-01-02 19:49                                                                               ` Pedro Alves
2012-01-19 16:24                                                                                 ` Call target_close after unpushing, not before (was: Re: [patch] Fix remote.c crash on gdbserver close (+fix py-finish-breakpoint.exp for gdbserver)) Pedro Alves
2012-01-19 16:27                                                                                   ` Jan Kratochvil
2012-01-19 16:37                                                                                     ` Call target_close after unpushing, not before Pedro Alves
2012-01-19 16:53                                                                                     ` [commit] Re: Call target_close after unpushing, not before (was: Re: [patch] Fix remote.c crash on gdbserver close (+fix py-finish-breakpoint.exp for gdbserver)) Jan Kratochvil
2012-01-04 14:49                                                                       ` [RFC] Python Finish Breakpoints Ulrich Weigand
2012-01-04 15:24                                                                         ` Kevin Pouget
2012-01-04 16:29                                                                           ` Ulrich Weigand
2012-01-04 16:42                                                                           ` Tom Tromey
2012-01-04 16:40                                                                         ` Tom Tromey
2012-01-04 17:13                                                                           ` Ulrich Weigand
2012-01-09  9:21                                                                             ` Kevin Pouget
2012-01-27 17:01                                                                               ` Kevin Pouget
2011-10-28 19:26                                   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPftXUKL-HFAgRWy8WGhq3fxpjH7ZFQkeWk_+Q3qdr87C+c2cA@mail.gmail.com \
    --to=kevin.pouget@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).