mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
Bug 473352 - [dynamic printf] The default printf format string does not support 64bit addresses
Change-Id: I85a8281d409c3a6d164bdb3434b197ab57c656c9 Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
parent
18ca0c7583
commit
9b8aa0e12c
2 changed files with 19 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2014 Ericsson and others.
|
||||
* Copyright (c) 2014, 2015 Ericsson and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -63,11 +63,23 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
|
|||
@Override
|
||||
protected void createAddressBreakpoint(IResource resource, IAddress address) throws CoreException {
|
||||
// We provide a default printf string to make the dynamic printf useful automatically
|
||||
String printfStr = NLS.bind(Messages.Default_AddressDynamicPrintf_String, address);
|
||||
|
||||
String format = getAddressFormat(address);
|
||||
String printfStr = NLS.bind(Messages.Default_AddressDynamicPrintf_String, address, format);
|
||||
|
||||
CDIDebugModel.createAddressDynamicPrintf(null, null, resource, getBreakpointType(), -1, address, true, 0, "", printfStr, true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param address
|
||||
* @return
|
||||
*/
|
||||
private String getAddressFormat(IAddress address) {
|
||||
String format = "0x%x"; //$NON-NLS-1$
|
||||
if (address.getValue().bitLength() > 32)
|
||||
format = "0x%llx"; //$NON-NLS-1$
|
||||
return format;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createAddressBreakpointInteractive(IWorkbenchPart part, IResource resource, IAddress address)
|
||||
throws CoreException
|
||||
|
@ -77,10 +89,9 @@ public class DisassemblyToggleDynamicPrintfTarget extends AbstractDisassemblyBre
|
|||
CDIDebugModel.setAddressBreakpointAttributes(
|
||||
attributes, null, null, getBreakpointType(), -1, address, true, 0, "" ); //$NON-NLS-1$
|
||||
|
||||
// Although the user will be given the opportunity to provide the printf string
|
||||
// in the properties dialog, we pre-fill it with the default string to be nice
|
||||
attributes.put(ICDynamicPrintf.PRINTF_STRING,
|
||||
NLS.bind(Messages.Default_AddressDynamicPrintf_String, address));
|
||||
String format = getAddressFormat(address);
|
||||
String printfStr = NLS.bind(Messages.Default_AddressDynamicPrintf_String, address, format);
|
||||
attributes.put(ICDynamicPrintf.PRINTF_STRING, printfStr);
|
||||
|
||||
openBreakpointPropertiesDialog(dprintf, part, resource, attributes);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ ToggleDynamicPrintfTargetFactory_name=C/C++ Dynamic Printf
|
|||
# http://sourceware.org/bugzilla/show_bug.cgi?id=15433
|
||||
Default_LineDynamicPrintf_String="Hit line %d of {0}\\n",{1}
|
||||
# We use %x in the below string on purpose to show the user that it is possible
|
||||
Default_AddressDynamicPrintf_String="Hit address 0x%x\\n",{0}
|
||||
Default_AddressDynamicPrintf_String="Hit address {1}\\n",{0}
|
||||
|
||||
GdbThreadFilterEditor_Thread=Thread
|
||||
GdbThreadFilterEditor_RestrictToSelected=&Restrict to Selected Processes and Threads:
|
||||
|
|
Loading…
Add table
Reference in a new issue