This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ping] [PATCH] python: accept address and explicit locations in gdb.decode_line


ping

Thanks,
Markus.

> -----Original Message-----
> From: Metzger, Markus T
> Sent: Friday, July 8, 2016 9:14 AM
> To: gdb-patches@sourceware.org
> Cc: keiths@redhat.com; yao.qi@arm.com
> Subject: [ping] [PATCH] python: accept address and explicit locations in
> gdb.decode_line
> 
> ping
> 
> See also the previous discussion: https://sourceware.org/ml/gdb-patches/2016-
> 06/msg00328.html.
> 
> Thanks,
> Markus.
> 
> > -----Original Message-----
> > From: Metzger, Markus T
> > Sent: Monday, June 20, 2016 4:33 PM
> > To: gdb-patches@sourceware.org
> > Cc: keiths@redhat.com
> > Subject: [PATCH] python: accept address and explicit locations in
> > gdb.decode_line
> >
> > The gdb.decode_line python function is documented to support the same
> > location
> > expressions as the "break" command.  It currently expects a linespec location.
> >
> > Instead of creating a linespec location directly, create the location via
> > string_to_event_location_basic.
> >
> > It's not clear to me whether I should use python_language or
> current_language,
> > though.  Is there some comment that explains it?
> >
> > 2016-06-20  Markus Metzger  <markus.t.metzger@intel.com>
> >
> > gdb/
> > 	* python/python.c (gdbpy_decode_line): Call
> > 	string_to_event_location_basic.
> >
> > testsuite/
> > 	* gdb.python/python.exp: Test decode_line("*0").
> > ---
> >  gdb/python/python.c                 | 2 +-
> >  gdb/testsuite/gdb.python/python.exp | 7 +++++++
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/gdb/python/python.c b/gdb/python/python.c
> > index 1f1fece..7bee890 100644
> > --- a/gdb/python/python.c
> > +++ b/gdb/python/python.c
> > @@ -738,7 +738,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
> >
> >    if (arg != NULL)
> >      {
> > -      location = new_linespec_location (&arg);
> > +      location = string_to_event_location_basic (&arg, python_language);
> >        make_cleanup_delete_event_location (location);
> >      }
> >
> > diff --git a/gdb/testsuite/gdb.python/python.exp
> > b/gdb/testsuite/gdb.python/python.exp
> > index 3f8c46f..4072fa3 100644
> > --- a/gdb/testsuite/gdb.python/python.exp
> > +++ b/gdb/testsuite/gdb.python/python.exp
> > @@ -251,6 +251,13 @@ gdb_py_test_silent_cmd {python symtab =
> > gdb.decode_line ("func1,func2")} \
> >      "test decode_line func1,func2" 1
> >  gdb_test {python print (symtab[0])} ",func2" "stop at comma in linespec"
> >
> > +gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"*0\")" "Test
> > decode_line *0" 1
> > +gdb_test "python print (len(symtab))" "2" "Test decode_line *0 result length"
> > +gdb_test "python print (symtab\[0\])" "None" "Test decode_line *0
> unparsed"
> > +gdb_test "python print (len(symtab\[1\]))" "1" "Test decode_line *0 locations
> > length"
> > +gdb_test "python print (symtab\[1\]\[0\].symtab)" "None" "Test decode_line
> > *0 filename"
> > +gdb_test "python print (symtab\[1\]\[0\].pc)" "0" "Test decode_line *0 pc"
> > +
> >  # gdb.write
> >  gdb_test "python print (sys.stderr)" ".*gdb.GdbOutputErrorFile
> > (instance|object) at.*" "Test stderr location"
> >  gdb_test "python print (sys.stdout)" ".*gdb.GdbOutputFile (instance|object)
> > at.*" "Test stdout location"
> > --
> > 1.8.3.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]