native_client/nacl-gdb.git
9 days agoFix nacl-gdb so that it can read ELF core dump files master
Mark Seaborn [Wed, 8 May 2013 22:30:43 +0000 (15:30 -0700)]
Fix nacl-gdb so that it can read ELF core dump files

Before this change, nacl-gdb gives the error "no core file handler
recognizes format" when given an ELF code dump file.

Fix this by setting up the register layout for core dumps.  Reuse the
same layout as for Linux code dumps for interoperability.

I tested this by producing a minidump from a NaCl minidump generator
and converting it to an ELF core dump using Breakpad's minidump-2-core
tool.  While we could generate a different register layout (e.g. using
NaCl's "struct NaClExceptionContext"), it's useful to keep the core
dumps readable by regular Linux GDB.

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3425
TEST=see above

Review URL: https://codereview.chromium.org/14757004

2 months agoRecognize NaCl OS ABI for all ELF files.
Andrey Khalyavin [Thu, 28 Feb 2013 13:48:57 +0000 (17:48 +0400)]
Recognize NaCl OS ABI for all ELF files.

We had already removed Linux OS ABI.  Now we must handle all ELF
files, otherwise their architecture is not initialized correctly
due to unknown OS ABI.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3313
TEST= ./scons --mode=opt-host,nacl platform=x86-64 bitcode=1 run_gdb_print_symbol_test

Review URL: https://codereview.chromium.org/12380017

3 months agoFix crash on executing nacl-manifest twice.
Andrey Khalyavin [Mon, 21 Jan 2013 11:50:03 +0000 (15:50 +0400)]
Fix crash on executing nacl-manifest twice.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3262
TEST= run_gdb_execute_nacl_manifest_twice,
      https://chromiumcodereview.appspot.com/11896007/

Review URL: https://codereview.chromium.org/11953013

3 months agoMerge GDB 7.5.1
Andrey Khalyavin [Wed, 16 Jan 2013 14:12:37 +0000 (18:12 +0400)]
Merge GDB 7.5.1

Merge bug fixes:
* Remove normal elf formats from nacl target in bfd/configure.bfd
* Force usage of AT_ENTRY_POINT mode for calling user functions.
* Update gdb/configure.tgt to exclude solib.o that is linked twice otherwise.

Review URL: https://codereview.chromium.org/11969036

4 months agoGDB 7.5.1 upstream
Andrey Khalyavin [Tue, 15 Jan 2013 12:11:11 +0000 (16:11 +0400)]
GDB 7.5.1

8 months agoImplement dummy_id for NaCl architecture because we need to sandbox frame pointer. master-backup
Andrey Khalyavin [Tue, 28 Aug 2012 12:59:00 +0000 (16:59 +0400)]
Implement dummy_id for NaCl architecture because we need to sandbox frame pointer.

This function describes stack frames created by gdb in order to call user functions.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2990
TEST= none

R=eaeltsin@google.com,khim@google.com

Review URL: https://chromiumcodereview.appspot.com/10897005

9 months agoDetect NaCl osabi from objfile
Evgeny Eltsin [Fri, 17 Aug 2012 15:28:21 +0000 (19:28 +0400)]
Detect NaCl osabi from objfile

This is needed to obtain correct gdbarch structure when doing get_objfile_arch.

In particular, with correct gdbarch structure GDB calls correct gdbarch_skip_prologue hook when setting breakpoints on function start.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2898

Review URL: https://chromiumcodereview.appspot.com/10829380

9 months agoTruncate address in amd64_nacl_software_single_step.
Andrey Khalyavin [Thu, 9 Aug 2012 12:16:44 +0000 (16:16 +0400)]
Truncate address in amd64_nacl_software_single_step.

If breakpoint is set to untruncated address, it is not recognized by
gdb as its own breakpoint. When the breakpoint is hit, rip is not decreased
and so execution starts from the middle of the instruction.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2947
TEST= https://chromiumcodereview.appspot.com/10826183/

R=khim@chromium.com,eaeltsin@google.com

Review URL: https://chromiumcodereview.appspot.com/10823232

9 months agoPrevent traps after rsp modification
Evgeny Eltsin [Wed, 1 Aug 2012 12:08:35 +0000 (16:08 +0400)]
Prevent traps after rsp modification

If trap happens after rsp is modified but before it is sandboxed, Win exception
handler fails to run. This applies to breakpoints and hardware-supported single
step.

We fix these by:
- use software single step to step both rsp modification and rsp sandboxing at once
- moving breakpoints from after rsp modification to after rsp sandboxing

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2903

Review URL: https://chromiumcodereview.appspot.com/10832095

9 months agoAllow to use quotes in nacl-manifest and nacl-irt commands.
Andrey Khalyavin [Wed, 1 Aug 2012 09:38:07 +0000 (13:38 +0400)]
Allow to use quotes in nacl-manifest and nacl-irt commands.

BUG= http://code.google.com/p/chromium/issues/detail?id=139880
TEST= execute nacl-manifest and nacl-irt commands with path surrounded by quotes.

Review URL: https://chromiumcodereview.appspot.com/10837039

9 months agoRecalculate stack frames after nacl-irt command.
Andrey Khalyavin [Fri, 27 Jul 2012 07:13:31 +0000 (11:13 +0400)]
Recalculate stack frames after nacl-irt command.

BUG= none
TEST= see an incorrect stack trace inside irt without irt symbols,
      execute nacl-irt command, see a correct stack trace.

R=eaeltsin@google.com

Review URL: https://chromiumcodereview.appspot.com/10833034

9 months agoAllow to add irt symbols with nacl-irt command.
Andrey Khalyavin [Thu, 26 Jul 2012 09:36:12 +0000 (13:36 +0400)]
Allow to add irt symbols with nacl-irt command.

BUG= none
TEST= use nacl-irt irt.nexe command and set breakpoint to __libc_init_array.

Review URL: https://chromiumcodereview.appspot.com/10828011

9 months agoGDB: fix offsets for reading svr4 link map on x86_64-nacl
Evgeny Eltsin [Wed, 18 Jul 2012 12:13:26 +0000 (16:13 +0400)]
GDB: fix offsets for reading svr4 link map on x86_64-nacl

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10797007

9 months agoGDB: set correct data model for x86_64-nacl
Evgeny Eltsin [Wed, 18 Jul 2012 11:57:04 +0000 (15:57 +0400)]
GDB: set correct data model for x86_64-nacl

This is required for reading typed values from target memory, in particular, to read correct pointer values.

The change is risky. It confuses a lot of code that uses pointer size to distinguish from x86_64 and i386. Luckily, this code is mostly about native debugging and syscalls, so it is not used for NaCl.

Anyway, the way to check for x86_64 by pointer size is lame, as it mixes architecture properties and data model. We plan to clean this up using some better check.

The change is hacky, as it fixes types of registers values directly. This should be done in xml descriptions instead. However, this requires much more work, and this requires introducing NaCl-specific xml files.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10798008

10 months agoAdd codereview.settings
Evgeny Eltsin [Tue, 17 Jul 2012 09:44:38 +0000 (13:44 +0400)]
Add codereview.settings

Recently we switched master branch to nacl-stub, and the latter has no codereview.settings.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10787034

10 months agoMerge GDB 7.4.1
Evgeny Eltsin [Tue, 17 Jul 2012 07:40:50 +0000 (11:40 +0400)]
Merge GDB 7.4.1

BUG=
TEST=scons debug stub+gdb tests

Review URL: https://chromiumcodereview.appspot.com/10789030

10 months agoGDB 7.4.1
Evgeny Eltsin [Tue, 17 Jul 2012 06:31:58 +0000 (10:31 +0400)]
GDB 7.4.1

10 months agoDumb change to support x86_64-nacl nacl-stub
Evgeny Eltsin [Thu, 12 Jul 2012 08:10:37 +0000 (12:10 +0400)]
Dumb change to support x86_64-nacl

This is definitely not enough or simply wrong, but works in most cases.
From the debug stub point of view, this should behave as expected in most cases as well.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2896
TEST=

Review URL: https://chromiumcodereview.appspot.com/10700182

11 months agoAutomatically run file command on remote connection to the target if NaCl
Andrey Khalyavin [Thu, 14 Jun 2012 07:39:23 +0000 (11:39 +0400)]
Automatically run file command on remote connection to the target if NaCl
manifest was provided by nacl-manifest command before that.

All information about NaCl program is already in the manifest. So we shouldn't
require to enter this information twice.

We can't just execute file command whenever user issues nacl-manifest command
though since we don't know the program architecture until gdb will connect to
debug stub. That's why this should be done the moment we know the program
architecture (and file command doesn't fail) but before gdb tries to find
symbols in the main program. The only such moment when we can execute our code
is about_to_proceed event.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2848
TEST= run chrome with --enable-nacl-debug --nacl-gdb=..., set breakpoints,
execute target remote command.

R=eaeltsin@google.com

Review URL: https://chromiumcodereview.appspot.com/10544136

11 months agoFix skipping first library for NaCl glibc programs.
Andrey Khalyavin [Thu, 31 May 2012 12:45:52 +0000 (16:45 +0400)]
Fix skipping first library for NaCl glibc programs.

NaCl glibc programs are started as dynamic linker with command line parameters.
So exec_bfd points out to the dynamic linker which has a .dynamic section. This
leads to ignore_first = 1 and skipping main program in dynamic library list. By
using interpreter check instead we weaken the condition to include the NaCl
case.

This adds to ignore_first = 0 branch all cases where main program doesn't have
an interpreter but has a .dynamic section i.e. launched program is a dynamic
linker or statically linked program that somehow loaded dynamic linker later. In
first case main (not a linker) program is first in the list. In the second case
statically linked program is not present in the list.

In Linux this adds main program to the list of shared libraries too if it is
launched via dynamic linker. But gdb can't load symbols for it since main
program has an empty name in the list.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2774
TEST= none
R=eaeltsin@google.com

Review URL: https://chromiumcodereview.appspot.com/10440066

11 months agoFix style issues.
Andrey Khalyavin [Thu, 31 May 2012 10:15:00 +0000 (14:15 +0400)]
Fix style issues.

BUG= none
TEST= none

Review URL: https://chromiumcodereview.appspot.com/10458028

11 months agoEnable NaCl OSABI and add manifest support.
Andrey Khalyavin [Fri, 25 May 2012 13:02:43 +0000 (17:02 +0400)]
Enable NaCl OSABI and add manifest support.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2774
TEST= none

Review URL: https://chromiumcodereview.appspot.com/10332242

11 months agoAdd NaCl OS ABI to enumeration.
Andrey Khalyavin [Wed, 23 May 2012 08:59:58 +0000 (12:59 +0400)]
Add NaCl OS ABI to enumeration.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2774
TEST= none

R=eaeltsin@google.com

Review URL: https://chromiumcodereview.appspot.com/10407091

11 months agoAdd hooks for mapping DSO library names.
Andrey Khalyavin [Wed, 23 May 2012 08:51:38 +0000 (12:51 +0400)]
Add hooks for mapping DSO library names.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2774
TEST= none

Review URL: https://chromiumcodereview.appspot.com/10411068

12 months agoConfigure gdb for nacl target
Andrey Khalyavin [Thu, 10 May 2012 10:40:35 +0000 (14:40 +0400)]
Configure gdb for nacl target

BUG= none
TEST= none

Review URL: https://chromiumcodereview.appspot.com/10365030

15 months agoGDB 7.4
Evgeny Eltsin [Wed, 25 Jan 2012 12:16:30 +0000 (16:16 +0400)]
GDB 7.4

18 months agoGDB 7.3.1
Evgeny Eltsin [Tue, 8 Nov 2011 09:03:29 +0000 (13:03 +0400)]
GDB 7.3.1

21 months agoGDB 7.3
Evgeny Eltsin [Mon, 15 Aug 2011 12:04:41 +0000 (16:04 +0400)]
GDB 7.3

3 years agoInitial commit of toolchain sources
Egor Pasko [Tue, 18 May 2010 12:26:51 +0000 (14:26 +0200)]
Initial commit of toolchain sources

  binutils-2.20
  gcc-4.4.3
  gdb-6.8
  newlib-1.18.0