Re: svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Wojciech Macek
Fixed.

2016-04-20 13:09 GMT-07:00 Ngie Cooper (yaneurabeya) 
:

>
> > On Apr 20, 2016, at 10:58, Wojciech Macek  wrote:
> >
> > Author: wma
> > Date: Wed Apr 20 17:58:13 2016
> > New Revision: 298358
> > URL: https://svnweb.freebsd.org/changeset/base/298358
> >
> > Log:
> >  Fix KGDB backtrace on ARM
> >
> >  Modify trapframe decoding to properly analyze trapframe.
> >
> >  Provide method for fixup_pc. It happens, that in some kernel
> >  functions, the GDB stack frame decoder cannot determine both
> >  func name and frame size. This is because these functions
> >  either contain invalid instruction, or their format does
> >  not match standard schema. Detect that scenarios and move
> >  PC accordingly to jump into known function schema, which
> >  GDB is able to parse.
> >
> >  Obtained from: Semihalf
> >  Sponsored by:  Juniper Networks
> >  Reviewed by:   kib, zbb
> >  Differential Revision: https://reviews.freebsd.org/D5976
>
> This broke the build on i386:
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/2909/ .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Ngie Cooper (yaneurabeya)

> On Apr 20, 2016, at 10:58, Wojciech Macek  wrote:
> 
> Author: wma
> Date: Wed Apr 20 17:58:13 2016
> New Revision: 298358
> URL: https://svnweb.freebsd.org/changeset/base/298358
> 
> Log:
>  Fix KGDB backtrace on ARM
> 
>  Modify trapframe decoding to properly analyze trapframe.
> 
>  Provide method for fixup_pc. It happens, that in some kernel
>  functions, the GDB stack frame decoder cannot determine both
>  func name and frame size. This is because these functions
>  either contain invalid instruction, or their format does
>  not match standard schema. Detect that scenarios and move
>  PC accordingly to jump into known function schema, which
>  GDB is able to parse.
> 
>  Obtained from: Semihalf
>  Sponsored by:  Juniper Networks
>  Reviewed by:   kib, zbb
>  Differential Revision: https://reviews.freebsd.org/D5976

This broke the build on i386: 
https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/2909/ .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Wojciech Macek
Author: wma
Date: Wed Apr 20 17:58:13 2016
New Revision: 298358
URL: https://svnweb.freebsd.org/changeset/base/298358

Log:
  Fix KGDB backtrace on ARM
  
  Modify trapframe decoding to properly analyze trapframe.
  
  Provide method for fixup_pc. It happens, that in some kernel
  functions, the GDB stack frame decoder cannot determine both
  func name and frame size. This is because these functions
  either contain invalid instruction, or their format does
  not match standard schema. Detect that scenarios and move
  PC accordingly to jump into known function schema, which
  GDB is able to parse.
  
  Obtained from: Semihalf
  Sponsored by:  Juniper Networks
  Reviewed by:   kib, zbb
  Differential Revision: https://reviews.freebsd.org/D5976

Modified:
  head/contrib/gdb/gdb/arm-tdep.c
  head/contrib/gdb/gdb/frame.c
  head/contrib/gdb/gdb/frame.h
  head/gnu/usr.bin/gdb/kgdb/kgdb.h
  head/gnu/usr.bin/gdb/kgdb/main.c
  head/gnu/usr.bin/gdb/kgdb/trgt_arm.c

Modified: head/contrib/gdb/gdb/arm-tdep.c
==
--- head/contrib/gdb/gdb/arm-tdep.c Wed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/arm-tdep.c Wed Apr 20 17:58:13 2016
(r298358)
@@ -678,6 +678,9 @@ arm_scan_prologue (struct frame_info *ne
   cache->framesize = 0;
   cache->frameoffset = 0;
 
+  if (frame_tdep_pc_fixup)
+   frame_tdep_pc_fixup(_pc);
+
   /* Check for Thumb prologue.  */
   if (arm_pc_is_thumb (prev_pc))
 {
@@ -914,7 +917,6 @@ arm_make_prologue_cache (struct frame_in
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
   arm_scan_prologue (next_frame, cache);
-
   unwound_fp = frame_unwind_register_unsigned (next_frame, cache->framereg);
   if (unwound_fp == 0)
 return cache;

Modified: head/contrib/gdb/gdb/frame.c
==
--- head/contrib/gdb/gdb/frame.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/frame.cWed Apr 20 17:58:13 2016
(r298358)
@@ -136,6 +136,7 @@ static int frame_debug;
 static int backtrace_past_main;
 static unsigned int backtrace_limit = UINT_MAX;
 
+int (*frame_tdep_pc_fixup)(CORE_ADDR *pc);
 
 void
 fprint_frame_id (struct ui_file *file, struct frame_id id)
@@ -2010,6 +2011,9 @@ frame_unwind_address_in_block (struct fr
   /* A draft address.  */
   CORE_ADDR pc = frame_pc_unwind (next_frame);
 
+  if ((frame_tdep_pc_fixup != NULL) && (frame_tdep_pc_fixup() == 0))
+   return pc;
+
   /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel),
  and NEXT is `normal' (i.e., not a sigtramp, dummy, ) THIS
  frame's PC ends up pointing at the instruction fallowing the

Modified: head/contrib/gdb/gdb/frame.h
==
--- head/contrib/gdb/gdb/frame.hWed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/frame.hWed Apr 20 17:58:13 2016
(r298358)
@@ -702,4 +702,6 @@ extern struct frame_info *deprecated_fra
code.  */
 extern int legacy_frame_p (struct gdbarch *gdbarch);
 
+extern int (*frame_tdep_pc_fixup)(CORE_ADDR *pc);
+
 #endif /* !defined (FRAME_H)  */

Modified: head/gnu/usr.bin/gdb/kgdb/kgdb.h
==
--- head/gnu/usr.bin/gdb/kgdb/kgdb.hWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/kgdb.hWed Apr 20 17:58:13 2016
(r298358)
@@ -75,4 +75,7 @@ CORE_ADDR kgdb_parse_1(const char *, int
 #definekgdb_parse(exp) kgdb_parse_1((exp), 0)
 #definekgdb_parse_quiet(exp)   kgdb_parse_1((exp), 1)
 
+extern int (*arm_tdep_pc_fixup)(CORE_ADDR *pc);
+int kgdb_trgt_pc_fixup(CORE_ADDR *pc);
+
 #endif /* _KGDB_H_ */

Modified: head/gnu/usr.bin/gdb/kgdb/main.c
==
--- head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 17:58:13 2016
(r298358)
@@ -474,7 +474,9 @@ main(int argc, char *argv[])
add_arg(, NULL);
 
init_ui_hook = kgdb_init;
-
+#if TARGET_CPUARCH == arm
+   frame_tdep_pc_fixup = kgdb_trgt_pc_fixup;
+#endif
kgdb_sniffer_kluge = kgdb_trgt_trapframe_sniffer;
 
return (gdb_main());

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_arm.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_arm.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_arm.cWed Apr 20 17:58:13 2016
(r298358)
@@ -96,6 +96,7 @@ kgdb_trgt_new_objfile(struct objfile *ob
 struct kgdb_frame_cache {
CORE_ADDR   fp;
CORE_ADDR   sp;
+   CORE_ADDR   pc;
 };
 
 static int kgdb_trgt_frame_offset[26] = {
@@ -135,6