public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "ppluzhnikov at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/11021] New: watch foo(x) -> infinite recursion
Date: Wed, 25 Nov 2009 21:49:00 -0000	[thread overview]
Message-ID: <20091125214957.11021.ppluzhnikov@google.com> (raw)

While trying to force a non-HW watchpoint, I did something possibly
unreasonable: set a watchpoint on an expression that requires call into
inferior.  But GDB did something unreasonable as well: it crashed :-(

int x;

int foo(int x) { return x; }

int main()
{
  x = 1;
  return 0;
}

gcc -g t.c -o t
gdb64-cvs -q ./t

(gdb) b 7
Breakpoint 1 at 0x400458: file t.c, line 7.
(gdb) r

Breakpoint 1, main () at t.c:7
7         x = 1;
(gdb) watch foo(x)
Segmentation fault (core dumped)

The crash stack trace is:
(top) bt 40
#0  0x00000000004f6f27 in update_global_location_list (should_insert=1) at
../../src/gdb/breakpoint.c:8367
#1  0x00000000004f731b in update_global_location_list_nothrow (inserting=1) at
../../src/gdb/breakpoint.c:8594
#2  0x00000000004fd533 in set_momentary_breakpoint (gdbarch=0xcf0310, sal=...,
frame_id=..., type=<value optimized out>) at ../../src/gdb/breakpoint.c:5918
#3  0x0000000000534336 in call_function_by_hand (function=0x1286be0, nargs=1,
args=0x7fffffb08bd8) at ../../src/gdb/infcall.c:740
#4  0x000000000050efda in evaluate_subexp_standard (expect_type=<value optimized
out>, exp=0xda9970, pos=0x7fffffb09104, noside=EVAL_NORMAL)
    at ../../src/gdb/eval.c:1574
#5  0x00000000005a41d0 in evaluate_subexp_c (expect_type=0xd200d0, exp=0x400390,
pos=0x7fffffb09104, noside=EVAL_NORMAL) at ../../src/gdb/c-lang.c:1037
#6  0x000000000050d5ed in evaluate_expression (exp=0x400390) at
../../src/gdb/eval.c:165
#7  0x00000000004f4aac in fetch_watchpoint_value (exp=0xda9970,
valp=0x7fffffb091d8, resultp=0x7fffffb091d0, val_chain=0x7fffffb091e0)
    at ../../src/gdb/breakpoint.c:950
#8  0x00000000004f5270 in update_watchpoint (b=0xd9e3b0, reparse=<value
optimized out>) at ../../src/gdb/breakpoint.c:1135
#9  0x00000000004f7513 in insert_breakpoints () at ../../src/gdb/breakpoint.c:1554
#10 0x00000000005421ac in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=0) at
../../src/gdb/infrun.c:1804
#11 0x00000000005337c0 in run_inferior_call (call_thread=0xd22580,
real_pc=4195400) at ../../src/gdb/infcall.c:372
#12 0x00000000005343e9 in call_function_by_hand (function=0x1286b20, nargs=1,
args=0x7fffffb095f8) at ../../src/gdb/infcall.c:794
#13 0x000000000050efda in evaluate_subexp_standard (expect_type=<value optimized
out>, exp=0xda9970, pos=0x7fffffb09b24, noside=EVAL_NORMAL)
    at ../../src/gdb/eval.c:1574
#14 0x00000000005a41d0 in evaluate_subexp_c (expect_type=0xd200d0, exp=0x400390,
pos=0x7fffffb09b24, noside=EVAL_NORMAL) at ../../src/gdb/c-lang.c:1037
#15 0x000000000050d5ed in evaluate_expression (exp=0x400390) at
../../src/gdb/eval.c:165
#16 0x00000000004f4aac in fetch_watchpoint_value (exp=0xda9970,
valp=0x7fffffb09bf8, resultp=0x7fffffb09bf0, val_chain=0x7fffffb09c00)
    at ../../src/gdb/breakpoint.c:950
#17 0x00000000004f5270 in update_watchpoint (b=0xd9e3b0, reparse=<value
optimized out>) at ../../src/gdb/breakpoint.c:1135
#18 0x00000000004f7513 in insert_breakpoints () at ../../src/gdb/breakpoint.c:1554
#19 0x00000000005421ac in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=0) at
../../src/gdb/infrun.c:1804
#20 0x00000000005337c0 in run_inferior_call (call_thread=0xd22580,
real_pc=4195400) at ../../src/gdb/infcall.c:372
#21 0x00000000005343e9 in call_function_by_hand (function=0x1285880, nargs=1,
args=0x7fffffb0a018) at ../../src/gdb/infcall.c:794
#22 0x000000000050efda in evaluate_subexp_standard (expect_type=<value optimized
out>, exp=0xda9970, pos=0x7fffffb0a544, noside=EVAL_NORMAL)
    at ../../src/gdb/eval.c:1574
#23 0x00000000005a41d0 in evaluate_subexp_c (expect_type=0xd200d0, exp=0x400390,
pos=0x7fffffb0a544, noside=EVAL_NORMAL) at ../../src/gdb/c-lang.c:1037
#24 0x000000000050d5ed in evaluate_expression (exp=0x400390) at
../../src/gdb/eval.c:165
#25 0x00000000004f4aac in fetch_watchpoint_value (exp=0xda9970,
valp=0x7fffffb0a618, resultp=0x7fffffb0a610, val_chain=0x7fffffb0a620)
    at ../../src/gdb/breakpoint.c:950
#26 0x00000000004f5270 in update_watchpoint (b=0xd9e3b0, reparse=<value
optimized out>) at ../../src/gdb/breakpoint.c:1135
#27 0x00000000004f7513 in insert_breakpoints () at ../../src/gdb/breakpoint.c:1554
#28 0x00000000005421ac in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=0) at
../../src/gdb/infrun.c:1804
#29 0x00000000005337c0 in run_inferior_call (call_thread=0xd22580,
real_pc=4195400) at ../../src/gdb/infcall.c:372
#30 0x00000000005343e9 in call_function_by_hand (function=0x12857c0, nargs=1,
args=0x7fffffb0aa38) at ../../src/gdb/infcall.c:794
#31 0x000000000050efda in evaluate_subexp_standard (expect_type=<value optimized
out>, exp=0xda9970, pos=0x7fffffb0af64, noside=EVAL_NORMAL)
    at ../../src/gdb/eval.c:1574
#32 0x00000000005a41d0 in evaluate_subexp_c (expect_type=0xd200d0, exp=0x400390,
pos=0x7fffffb0af64, noside=EVAL_NORMAL) at ../../src/gdb/c-lang.c:1037
#33 0x000000000050d5ed in evaluate_expression (exp=0x400390) at
../../src/gdb/eval.c:165
#34 0x00000000004f4aac in fetch_watchpoint_value (exp=0xda9970,
valp=0x7fffffb0b038, resultp=0x7fffffb0b030, val_chain=0x7fffffb0b040)
    at ../../src/gdb/breakpoint.c:950
#35 0x00000000004f5270 in update_watchpoint (b=0xd9e3b0, reparse=<value
optimized out>) at ../../src/gdb/breakpoint.c:1135
#36 0x00000000004f7513 in insert_breakpoints () at ../../src/gdb/breakpoint.c:1554
#37 0x00000000005421ac in proceed (addr=0, siggnal=TARGET_SIGNAL_0, step=0) at
../../src/gdb/infrun.c:1804
#38 0x00000000005337c0 in run_inferior_call (call_thread=0xd22580,
real_pc=4195400) at ../../src/gdb/infcall.c:372
#39 0x00000000005343e9 in call_function_by_hand (function=0x1284500, nargs=1,
args=0x7fffffb0b458) at ../../src/gdb/infcall.c:794

-- 
           Summary: watch foo(x) -> infinite recursion
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: ppluzhnikov at google dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11021

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2009-11-25 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 21:49 ppluzhnikov at google dot com [this message]
2010-08-14  3:03 ` [Bug breakpoints/11021] " pedro at codesourcery dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091125214957.11021.ppluzhnikov@google.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).