Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rstudio/rstudio
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jun 9, 2011
2 parents 3c314fd + fab9632 commit 53593de
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package/linux/make-package
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cd $BUILD_DIR
rm -f CMakeCache.txt
rm -rf $BUILD_DIR/_CPack_Packages
cmake -DRSTUDIO_TARGET=$1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DRSTUDIO_PACKAGE_BUILD=1 \
-DCMAKE_INSTALL_PREFIX=/usr/lib/$INSTALL_DIR \
../../..
Expand Down
8 changes: 7 additions & 1 deletion src/cpp/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,16 @@ if(RSTUDIO_BUNDLE_QT)
endif()
endif(RSTUDIO_BUNDLE_QT)

# add rstudio icon to root (so people installing from source or tar.gz can find it
if (UNIX AND NOT APPLE)
# add rstudio icon to root (so people installing from source or tar.gz can find it
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/freedesktop/icons/48x48/rstudio.png
DESTINATION ${RSTUDIO_INSTALL_SUPPORTING})

# install configured backtrace utility on linux
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rstudio-backtrace.sh.in
${CMAKE_CURRENT_BINARY_DIR}/rstudio-backtrace.sh)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/rstudio-backtrace.sh
DESTINATION ${RSTUDIO_INSTALL_BIN})
endif()


Expand Down
71 changes: 71 additions & 0 deletions src/cpp/desktop/rstudio-backtrace.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

# check if rstudio is already running
PIDOF_RSTUDIO=`pidof rstudio`
if ! test -z $PIDOF_RSTUDIO
then
echo ""
echo "RStudio already running (quit existing sessions before running this utility)"
echo ""
exit 1
fi

# record current working dir
CURRENT_DIR=`pwd`

# make sure gdb is installed
sudo apt-get install gdb

# allow core dumps of unlimited size
ulimit -c unlimited

# set core pattern to custom value
OLD_CORE_PATTERN=`cat /proc/sys/kernel/core_pattern`
CORE_DIR=/tmp/rstudio/coredumps
rm -rf $CORE_DIR
mkdir -p $CORE_DIR
chmod 777 $CORE_DIR
sudo sh -c "echo $CORE_DIR/%e.core > /proc/sys/kernel/core_pattern"

# outfile
RSTUDIO_BACKTRACE_OUT=$CURRENT_DIR/rstudio-backtrace.txt
sudo rm -f $RSTUDIO_BACKTRACE_OUT
touch $RSTUDIO_BACKTRACE_OUT

# run rstudio
${CMAKE_INSTALL_PREFIX}/bin/rstudio

# create gdb command file for backtraces
RSTUDIO_BACKTRACE_GDB=/tmp/rstudio-backtrace.gdb
sudo rm -f $RSTUDIO_BACKTRACE_GDB
cat <<'EOF' > $RSTUDIO_BACKTRACE_GDB
thread apply all bt
quit
EOF

# write any backtraces we found
if test -e $CORE_DIR/rstudio.core
then
# write backtraces for rstudio
gdb --command=$RSTUDIO_BACKTRACE_GDB \
${CMAKE_INSTALL_PREFIX}/bin/rstudio $CORE_DIR/rstudio.core \
>> $RSTUDIO_BACKTRACE_OUT 2>/dev/null
fi

if test -e $CORE_DIR/rsession.core
then
# write backtraces for rsession
gdb --command=$RSTUDIO_BACKTRACE_GDB \
${CMAKE_INSTALL_PREFIX}/bin/rsession $CORE_DIR/rsession.core \
>> $RSTUDIO_BACKTRACE_OUT 2>/dev/null
fi


# remove tmp backtrace command file
rm $RSTUDIO_BACKTRACE_GDB

# restore old core pattern
sudo sh -c "echo $OLD_CORE_PATTERN > /proc/sys/kernel/core_pattern"



2 changes: 1 addition & 1 deletion src/cpp/r/session/REmbeddedWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void initializePolledEventHandler(void (*newPolledEventHandler)(void))
s_polledEventHandler = newPolledEventHandler;
}

void disablePolledEventHandler()
void permanentlyDisablePolledEventHandler()
{
s_polledEventHandler = NULL;
}
Expand Down
5 changes: 4 additions & 1 deletion src/cpp/r/session/RSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,13 @@ int RReadConsole (const char *prompt,
// ensure rstudio tools are loaded before prompting
r::sourceManager().ensureToolsLoaded();

std::string promptString(prompt);
promptString = util::rconsole2utf8(promptString);

// get the next input
bool addToHistory = (hist == 1);
RConsoleInput consoleInput;
if ( s_callbacks.consoleRead(prompt, addToHistory, &consoleInput) )
if ( s_callbacks.consoleRead(promptString, addToHistory, &consoleInput) )
{
// add prompt to console actions (we do this after consoleRead
// completes so that we don't send both a console prompt event
Expand Down

0 comments on commit 53593de

Please sign in to comment.