From owner-freebsd-hackers Tue Nov 19 20:14:51 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B35C37B401 for ; Tue, 19 Nov 2002 20:14:49 -0800 (PST) Received: from ns.aus.com (adsl-66-127-240-212.dsl.sntc01.pacbell.net [66.127.240.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 432DD43E6E for ; Tue, 19 Nov 2002 20:14:43 -0800 (PST) (envelope-from rsharpe@ns.aus.com) Received: from localhost (rsharpe@localhost) by ns.aus.com (8.11.6/8.11.6) with ESMTP id gAK4ckE06332 for ; Wed, 20 Nov 2002 15:08:46 +1030 Date: Wed, 20 Nov 2002 15:08:46 +1030 (CST) From: Richard Sharpe To: Subject: A small change to help GDB load symbol files from scripts Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="296485252-1013930197-1037767126=:6081" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --296485252-1013930197-1037767126=:6081 Content-Type: TEXT/PLAIN; charset=US-ASCII Hi, The following small patch to 4.6.2: --- sys/sys/linker.h.orig Tue Nov 19 20:05:29 2002 +++ sys/sys/linker.h Tue Nov 19 11:24:30 2002 @@ -94,6 +94,7 @@ int id; /* unique id */ caddr_t address; /* load address */ size_t size; /* size of file */ + size_t text_offs; /* Location of text */ int ndeps; /* number of dependancies */ linker_file_t* deps; /* list of dependancies */ STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ --- sys/kern/link_elf.c.orig Tue Nov 19 20:08:32 2002 +++ sys/kern/link_elf.c Tue Nov 19 17:59:16 2002 @@ -611,6 +611,7 @@ } lf->address = ef->address; lf->size = mapsize; + lf->text_offs = hdr->e_entry;; error = parse_dynamic(lf); if (error) Would allow the following sort of gdb script file: define load-ko-syms path ./freebsd_46_i386/debug/export/kernel set $file = linker_files.tqh_first set $file = $file->link.tqe_next if ($file == 0) printf "No klds to load symbols for\n" else while ($file != 0) add-symbol-file $file->filename ($file->address + $file->text_offs) printf "Loaded symbols for %s\n", $file->filename set $file = $file->link.tqe_next end end end Of course, you will need a recent version of GDB. -- Regards ----- Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, sharpe[at]ethereal.com, http://www.richardsharpe.com --296485252-1013930197-1037767126=:6081 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="freebsd_linker.change" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Diff File Content-Disposition: attachment; filename="freebsd_linker.change" LS0tIHN5cy9zeXMvbGlua2VyLmgub3JpZwlUdWUgTm92IDE5IDIwOjA1OjI5 IDIwMDINCisrKyBzeXMvc3lzL2xpbmtlci5oCVR1ZSBOb3YgMTkgMTE6MjQ6 MzAgMjAwMg0KQEAgLTk0LDYgKzk0LDcgQEANCiAgICAgaW50CQkJaWQ7CQkv KiB1bmlxdWUgaWQgKi8NCiAgICAgY2FkZHJfdAkJYWRkcmVzczsJLyogbG9h ZCBhZGRyZXNzICovDQogICAgIHNpemVfdAkJc2l6ZTsJCS8qIHNpemUgb2Yg ZmlsZSAqLw0KKyAgICBzaXplX3QgICAgICAgICAgICAgIHRleHRfb2Zmczsg ICAgICAvKiBMb2NhdGlvbiBvZiB0ZXh0ICovDQogICAgIGludAkJCW5kZXBz OwkJLyogbnVtYmVyIG9mIGRlcGVuZGFuY2llcyAqLw0KICAgICBsaW5rZXJf ZmlsZV90KglkZXBzOwkJLyogbGlzdCBvZiBkZXBlbmRhbmNpZXMgKi8NCiAg ICAgU1RBSUxRX0hFQUQoLCBjb21tb25fc3ltYm9sKSBjb21tb247IC8qIGxp c3Qgb2YgY29tbW9uIHN5bWJvbHMgKi8NCi0tLSBzeXMva2Vybi9saW5rX2Vs Zi5jLm9yaWcJVHVlIE5vdiAxOSAyMDowODozMiAyMDAyDQorKysgc3lzL2tl cm4vbGlua19lbGYuYwlUdWUgTm92IDE5IDE3OjU5OjE2IDIwMDINCkBAIC02 MTEsNiArNjExLDcgQEANCiAgICAgfQ0KICAgICBsZi0+YWRkcmVzcyA9IGVm LT5hZGRyZXNzOw0KICAgICBsZi0+c2l6ZSA9IG1hcHNpemU7DQorICAgIGxm LT50ZXh0X29mZnMgPSBoZHItPmVfZW50cnk7Ow0KIA0KICAgICBlcnJvciA9 IHBhcnNlX2R5bmFtaWMobGYpOw0KICAgICBpZiAoZXJyb3IpDQo= --296485252-1013930197-1037767126=:6081-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message