From owner-svn-src-stable@FreeBSD.ORG Mon Dec 17 05:13:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9DFBEC2A; Mon, 17 Dec 2012 05:13:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 805EF8FC14; Mon, 17 Dec 2012 05:13:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBH5DG90022367; Mon, 17 Dec 2012 05:13:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBH5DGiw022365; Mon, 17 Dec 2012 05:13:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201212170513.qBH5DGiw022365@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 17 Dec 2012 05:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r244337 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 05:13:16 -0000 Author: kib Date: Mon Dec 17 05:13:15 2012 New Revision: 244337 URL: http://svnweb.freebsd.org/changeset/base/244337 Log: MFC r243836: Print the frame addresses for the backtraces on i386 and amd64. Modified: stable/9/sys/amd64/amd64/db_trace.c stable/9/sys/i386/i386/db_trace.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -186,7 +186,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static int db_numargs(struct amd64_frame *); -static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t, + void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -230,12 +231,13 @@ db_numargs(fp) } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; long *argp; db_addr_t callpc; + void *frame; { db_printf("%s(", name); #if 0 @@ -250,6 +252,8 @@ db_print_stack_entry(name, narg, argnp, #endif db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%lx", (register_t)frame); db_printf("\n"); } @@ -341,7 +345,7 @@ db_nextframe(struct amd64_frame **fp, db return; } - db_print_stack_entry(name, 0, 0, 0, rip); + db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame); /* * Point to base of trapframe which is just above the @@ -437,7 +441,8 @@ db_backtrace(struct thread *td, struct t * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first = FALSE; @@ -451,7 +456,7 @@ db_backtrace(struct thread *td, struct t narg = db_numargs(frame); } - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); if (actframe != frame) { /* `frame' belongs to caller. */ @@ -465,7 +470,7 @@ db_backtrace(struct thread *td, struct t if (INKERNEL((long)pc) && !INKERNEL((long)frame)) { sym = db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((long) frame)) { Modified: stable/9/sys/i386/i386/db_trace.c ============================================================================== --- stable/9/sys/i386/i386/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/i386/i386/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -176,7 +176,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); -static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, + void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -220,12 +221,13 @@ retry: } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; int *argp; db_addr_t callpc; + void *frame; { int n = narg >= 0 ? narg : 5; @@ -242,6 +244,8 @@ db_print_stack_entry(name, narg, argnp, db_printf(",..."); db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%r", (register_t)frame); db_printf("\n"); } @@ -326,7 +330,7 @@ db_nextframe(struct i386_frame **fp, db_ return; } - db_print_stack_entry(name, 0, 0, 0, eip); + db_print_stack_entry(name, 0, 0, 0, eip, &(*fp)->f_frame); /* * For a double fault, we have to snag the values from the @@ -467,7 +471,8 @@ db_backtrace(struct thread *td, struct t * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first = FALSE; @@ -481,7 +486,7 @@ db_backtrace(struct thread *td, struct t narg = db_numargs(frame); } - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); if (actframe != frame) { /* `frame' belongs to caller. */ @@ -495,7 +500,7 @@ db_backtrace(struct thread *td, struct t if (INKERNEL((int)pc) && !INKERNEL((int) frame)) { sym = db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((int) frame)) {